Mi código es el siguiente. Quiero habilitar el campo de área de texto haciendo clic en la casilla de verificación y desactivar el campo de área de texto nuevamente haciendo clic en la casilla de verificación.
¿Cómo debería hacer esto?
mi código js:
if ($('#checkbox').prop('checked')) { $('#fldScript').attr('disabled', false); } else { $('#fldScript').attr('disabled', true); } function Script() { var ua = navigator.userAgent; if (ua && ua.toUpperCase().indexOf("OPERA MINI") > -1) { return false; } var Script = CodeMirror.fromTextArea(document.getElementById("fldScript"), { mode: "text/javascript", tabMode: "indent", styleActiveline: true, htmlMode: true, lineWrapping: true, foldgutter: true, autoCloseTags: true, autoCloseBrackets: true, highlightSelectionMatches: true, smartIndent: false, extraKeys: { "Ctrl-Space": "autocomplete", "F11": function(cm) { cm.setOption("fullScreen", !cm.getOption("fullScreen")); }, "Esc": function(cm) { if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); } }, }); Script.on("change", function() { Script.save(); }); Script.on('dblclick', function() { if (Script.getOption("fullScreen") == false) Script.setOption("fullScreen", !Script.getOption("fullScreen")); }); } Script();mi código html:
<input type="checkbox" id="checkbox" value="0"> checkbox <br> <br> <textarea id="fldScript"></textarea>