Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
JavaScript problem with special characters

I developed a simple form, and when I click on the button it checks that all fields are entered correctly. If not, a message appears below the field, very standard

The problem lies in two words, "minimum" and "maximum". Location is correct, words are being displayed, but online on hosting is not.

On the pages is the <meta charset="UTF-8"> and I tried too <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>. And also inserted in the script tag <script src="js/contatPage.js" charset="UTF-8" type="module"></script> and <script src="js/contatPage.js" charset="iso-8859-1" type="module"></script>. None of these worked

Function that receives the input, checks and calls the function to create the message

...
function check(e)
   ...
   {else if(e.value.length < e.minLength){
      createMessage(e, `Quantidade mínima de caracteres ${e.minLength}`) 
   }
   ...
...

Error example image enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Some special letters can't be typed directly to HTML, and must be inserted using the HTML special characters, the main are all at W3Schools, and most were added in VS Code, so when you type '&' inside a HTML File, it suggests some for you. Check more about here, navigate in the left side.

In your script:

function check(e) // e is probably a text element, right?
{
   // Your conditions for message...
   createMessage(e, `Quantidade m&iacute;nima de caracteres ${e.minLength}`)
   // In this "createMessage" function, you will need to use the element's
   // innerHTML property, so the HTML character (&iacute = í) will be parsed
}

// For example...
function createMessage(e)
{
   e.target.innerHTML = "Sua mensagem &eacute; digitada aqui, meu jovem!";
}

Good luck, hope this helps!

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda