I have some disabled check boxes when the screen loads and change of one of the textbox the check box get automatically checked and i want the checkbox value to be submitted to my backing bean during form submit so i attached an onclick function to the submit button through Jquery to enable the checbox at submit time but still the values are not submitted but if i directly add a javascript function to the onclick of submit button the values get submmited.
My code looks like this
<input type="checkbox" id="chck_box1" class="enableCheckbox"/>
<input type="submit" id="submitButton" onclick="enableCheckBox()"/>
there are two ways i implemented
**1.** --- this enables the checkbox and values submitted
function enableCheckbox(){
$('.enableCheckbox').each(function() {
$(this).removeAttr('disabled');
});
}
**2.** -- this enables the checkbox but the values not submitted
$("#submitButton").on("click", function(){
$('.enableCheckbox').each(function() {
$(this).removeAttr('disabled');
});
});
Can some one help me to understand the difference between the submit button onclick and jquery's on(submit)
thanks