Input Search disabled Property - Disable and enable a search field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Search

Description

Input Search disabled Property - Disable and enable a search field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Search: <input type="search" id="mySearch"><br><br>

<button onclick="disableBtn()">Disable Search Field</button>
<button onclick="enableBtn()">Enable Search Field</button>

<script>
function disableBtn() {//from   w  ww.j  a  v a2  s  .  c om
    document.getElementById("mySearch").disabled = true;
}
function enableBtn() {
    document.getElementById("mySearch").disabled = false;
}
</script>

</body>
</html>

Related Tutorials