Input Week readOnly Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Week

Description

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

Return Value

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:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials