I have a form and wanted that when the page was loaded, if my checkbox is set, disable the "disable" property of the form.
In the code example below, I put checked="checked"
but it only works if I click to disable and click again to enable.
Well lost in it.
Could you help me?
$('#meuCheckbox').click(function() {
$('#meuTexto').attr('disabled',! this.checked)
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script><inputtype="text" disabled="disabled" id="meuTexto" /><input type="checkbox" id="meuCheckbox" checked="checked" />