Hi Community,
I'm trying to work with checkbox and input box, the function is to disable the input box when the checkbox is being check, however the problem is when the page back using back button even the checkbox is being check the input box are enabled. How to restore/retain the value
Here when the check is clicked/check the input boxes was disabled
However, when I go back using back button even the checkbox is being clicked/check the input boxes is enabled
The code for disabled the input boxes when the checkbox is being clicked
jQuery('input[type="checkbox"]').on("click",function(){
if(jQuery( "[id='checkboxid']" ).prop('checked')== true)
{
jQuery(''id="inputboxid1"]').prop("disabled",true).val('');
jQuery(''id="inputboxid2"]').prop("disabled",true).val('');
jQuery(''id="inputboxid3"]').prop("disabled",true).val('');
jQuery(''id="inputboxid4"]').prop("disabled",true).val('');
}
else {
jQuery('yid="inputboxid1"]').prop("disabled",false);
jQuery('yid="inputboxid2"]').prop("disabled",false);
jQuery('yid="inputboxid3"]').prop("disabled",false);
jQuery('yid="inputboxid4"]').prop("disabled",false);
}
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.