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

147
Vistas
issue with the code not working in internet explorer

I am using one code which is working in all browsers but not in IE11 or IE10

how can i fix it

$(`#${formID} textarea:not(.ctype)`).each(function(k) {

because it seems the usage of the ` is problematic and IE does not like it

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to mock template literals in IE, the closest thing you can do is format a string and replace placeholder values with an entry map.

// Custom formatter function
function frmt(str, obj) {
  return Object.entries(obj).reduce(function(acc, [key, val]) {
    return acc.replace(new RegExp('\\$\\{' + key + '\\}', 'g'), val);
  }, str);
}

// jQuery selector
const selector = frmt('#${formID} textarea:not(.ctype)', { formID: 'my-form' });

console.log(selector);

$(selector).each(function(textarea) {
  console.log($(this).text());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="my-form">
  <textarea>A</textarea>
  <textarea>B</textarea>
  <textarea class="ctype">C</textarea>
</form>


If you want to make the code portable, you can write a jQuery plugin:

// Custom selector plugin
(function($) {
  $.sel = function(selector, repl) {
    return $(Object.entries(repl).reduce(function(acc, [key, val]) {
      return acc.replace(new RegExp('\\$\\{' + key + '\\}', 'g'), val);
    }, selector));
  };
})(jQuery);


$.sel('#${formID} textarea:not(.ctype)', { formID: 'my-form' })
  .each(function(textarea) {
    console.log($(this).text());
  });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="my-form">
  <textarea>A</textarea>
  <textarea>B</textarea>
  <textarea class="ctype">C</textarea>
</form>

about 4 years ago · Juan Pablo Isaza Denunciar
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