With the code shown below, I would like to disable the text input when the user clicks on the button.
When I click on my button, the text input only disables for one second, before it enables again.
I would like to know why does this happens.
<html>
<head>
<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$('#enable').click(function() {
$('#textBox').removeAttr("disabled")
});
$('#disable').click(function() {
$('#textBox').attr("disabled", "disabled");
});
});
</script>
</head>
<body>
<form>
<input type="text" id="textBox" />
<button id="enable">Enable</button>
<button id="disable">Disable</button>
</form>
</body>
</html>