Javascript examples for DOM HTML Element:Input Week
The readOnly property sets or gets whether a week field should be read-only.
This property reflects the HTML readonly attribute.
Set the readOnly property with the following Values
Value | Description |
---|---|
true|false | Sets whether a week field should be read-only |
A Boolean, returns true if the week field is read-only, otherwise it returns false
The following code shows how to Set a week field to read-only:
<!DOCTYPE html> <html> <body> <input type="week" id="myWeek" readonly> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww . j ava 2 s.co m document.getElementById("myWeek").readOnly = true; document.getElementById("demo").innerHTML = 'changed'; } </script> </body> </html>