Javascript DOM HTML Input URL disabled Property set

Introduction

Disable a URL field:

document.getElementById("myURL").disabled = true;

Click the button to disable the URL field.

elements with type="url" are not supported in Safari.

View in separate window

<!DOCTYPE html>
<html>
<body>
Homepage: <input type="url" id="myURL">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from  www  .  j ava2 s . co  m*/
  document.getElementById("myURL").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a URL field should be disabled, or not.

This property mirrors the HTML disabled attribute.

Property Values

Value Description
trueThe URL field is disabled
falseDefault. The URL field is not disabled

The disabled property returns true if the URL field is disabled, otherwise it returns false.




PreviousNext

Related