I understood that adding readonly
attribute to check box does not make it readonly. Also adding disable
attribute will not post the value.
On this SO post there are different options suggested to make the check box readonly.
However, i want to toggle the readonly state of the check box on some button click, and also post the value on form submit.
So as suggested i added "return false" on click event. Works fine. However how do i toggle this behavior?
<button type="button" id="btn">Toggle</button>
<input type="checkbox" value="false" onClick="return false;" name="CheckBox1" />
$(document).ready(function() {
$("#btn").click(function()
{
//how do i toggle readonly here
})
});
Aucun commentaire:
Enregistrer un commentaire