1
I have a form and wanted that when the page was loaded, if my checkbox is set, disable the "disable" form property.
In the code example below, I put checked="checked"
but only works if I click to disable and click again to enable.
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>
<input type="text" disabled="disabled" id="meuTexto" /><input type="checkbox" id="meuCheckbox" checked="checked" />