In this example we will learn how to enable the button when the user put some data in the input field.
bt.disabled = true; Is used to enable a disable button. By default in this example the button is disbaled.
<!DOCTYPE html>
<html>
<body>
<input type="text" id="txt" onkeyup="manage(this)" />
<input type="submit" id="btSubmit" disabled />
<script>
function manage(txt) {
var bt = document.getElementById('btSubmit');
if (txt.value != '') {
bt.disabled = false;
}
else {
bt.disabled = true;
}
}
</script>
</body>
</html>