How to disable checkbox without using disabled?

2

How could I inhibit changing checkbox without using disabled , since I want to send it via form.

<input type="checkbox" name="option1" readonly="readonly" checked="checked"/> 
// esta alterando
<input type="checkbox" name="option2" disabled="disabled" checked="checked"/> 
// não envia pelo form
    
asked by anonymous 15.03.2016 / 15:22

1 answer

4

Without using the default disabled property you can for a return in onclick .

This happens because using return false stops the click event that changes the value of the checkbox.

<input type="checkbox" name="option1" checked="checked" onclick="return false;"/> Teste

Reference: Can HTML checkboxes be set to readonly?

    
15.03.2016 / 15:25