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

224
Visualizações
How to sense a particular letter in user input in JS

If I type something with the letter 1 it should redirect to another page for eg: 1sometxt.
if not it should redirect to another page

function functionclick() {
     var input = document.getElementById("myInput").value;
     var input1 = "1";
     if (input === input1 + i dont know what to give here ) {
         window.open("www.example.com");
     }else {
window.open("www.example.com");
}
 }
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

document.getElementById("myInput").addEventListener("change"), (e)=>{

     var input = e.target.value
    
     if (input.includes(1) ) {
         window.open("www.example.com");
     }else {
         window.open("www.example.com");
     }
}
about 4 years ago · Juan Pablo Isaza Relatório

0

You can check if input contain '1' by using input.includes('1'), or if '1' should be the first character the if condition could be something like this

if(input[0] === input1) { // doesn't matter what next characters are, check if input first character equal to input1 variable
  // your code here
}
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