Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
¿Cómo detectar letras prohibidas en una variable que proviene de html en javascript?

en realidad, mi inglés no es bueno, pero quiero detectar letras prohibidas en una variable que proviene de la entrada html pero no funciona. Mi código:

 nextBtnFirst.addEventListener("click", function(event) { event.preventDefault(); //Validating the required Fields// var fname = document.getElementById("fname_id").value; var lname = document.getElementById("lname_id").value; var letters = "/^[0-9a-zA-Z]+$/"; if(fname =="" || lname=="") { updateError("First name and Last name is required!"); } else { slidePage.style.marginLeft = "-25%"; bullet[current - 1].classList.add("active"); progressCheck[current - 1].classList.add("active"); progressText[current - 1].classList.add("active"); current += 1; } });

Lo que he intentado pero no funcionó:

 if(fname.includes("!")) { updateError("Dont use forbidden Characters!"); }

Por favor ayuda. ¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Cambiar var fname = document.getElementById("fname_id").value; a esta var fname = document.getElementById("fname_id").innerText;

El objeto HTMLElement no tiene propiedad de value .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!