Using “attr()” function we will enable or disable submit button please find below code.
$(document).ready(function() {
$(‘input[type=”submit”]’).attr(‘disabled’, true);
$(‘input[type=”text”]’).on(‘keyup’,function() {
if($(this).val() != ”) {
$(‘input[type=”submit”]’).attr(‘disabled’ , false);
}else{
$(‘input[type=”submit”]’).attr(‘disabled’ , true);
}
});
});
/*Add and remove readonly to a textbox*/
if(rBtnVal == "yes"){
$("#no_of_staff").attr("readonly", false);
}
else{
$("#no_of_staff").attr("readonly", true);
}