I have the following HTML and JS. The Controls are disabled when the page loads. I need to enable the controls when the user clicks the Enable Button and when the user clicks the Disable Button the Conrols needs to disabled again.
<div id="main" >
<input type="text" id="Year" name="Year" class="mytextbox disabled" />
<br />
<input type="text" id="StudentID" name="StudentID" class="mytextbox disabled" />
<br />
<br />
<input type="button" id="enableButton" name="enableButton" value="Enable" />
<br />
<br />
<input type="button" id="disableButton" name="disableButton" value="Disable" />
</div>
$(".disabled").keydown(function (e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false;
});
$(".disabled").bind("copy paste cut", function (e) {
e.preventDefault ? e.preventDefault() : e.returnValue = false;
});
$("#enableButton").click(function (e) {
$(".mytextbox").removeClass("disabled");
});
$("#disableButton").click(function (e) {
$(".mytextbox").addClass("disabled");
});