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

265
Vistas
Receiving an [object HTMLInputElement] error when trying to convert characters

I have the following code for which I am trying to convert input entered by a user to replace certain characters (e with a 3 and t with a 7) but instead, I am getting a [object HTMLInputElement] error in my output.

function ReplaceChars() {

  var json = JSON.parse(localStorage.getItem("registration"));
  var characters = json['charsEntered'];
  var percentage = "";
  var total = "";

  result = characters
    .replaceAll(/e|E/g, "3")
    .replaceAll(/t|T/g, "7")

  total = characters.length;

  if (result.match(/e|E|t|T/g) == null) {

    roundedPercentage = 0.00;
    result = charsEntered;
  } else {

    percentage = ((characters.match(/e|E|t|T/g).length) / total) * 100
    roundedPercentage = percentage.toFixed(2);
  }

  console.log(result);

  $("#charsConverted").val(result);
  $("#percentage").val(roundedPercentage + "%");

}

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