The readOnly
property sets or gets whether or not a week field should be read-only.
readOnly |
Yes | No | No | Yes | Yes |
Return the readOnly property.
var v = weekObject.readOnly
Set the readOnly property.
weekObject.readOnly=true|false
Value | Description |
---|---|
true|false | Specifies whether or not a week field should be read-only
|
A Boolean type value, true if the week field is read-only, otherwise false.
The following code shows how to check if a week field is read-only.
<!DOCTYPE html>
<html>
<body>
<!--from w w w .j a va 2s. com-->
<input type="week" id="myWeek" readonly>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myWeek").readOnly;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to change a week field to read-only.
<!DOCTYPE html>
<html>
<body>
<input type="week" id="myWeek">
<button onclick="myFunction()">test</button>
<!--from www .j a v a2 s. co m-->
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myWeek").readOnly = true;
}
</script>
</body>
</html>
The code above is rendered as follows: