Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
codemirror: Change codemirror the to be disabled or visible by another field

My code is as follows. I want to enable the textarea field by clicking on the checkbox and deactivate the textarea field again by clicking checkbox .

How should I do this?

my js code :

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();

my html code :

<input type="checkbox" id="checkbox" value="0"> checkbox
<br>
<br>
<textarea id="fldScript"></textarea>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda