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

203
Views
La función JS onclick no funciona. No está llamando validaciones.

A continuación se muestra la función y no funciona. Tal vez algún pequeño error en el código que no puedo identificar.

 <!DOCTYPE html> <script> function check(){ firstname=document.getelementById("firstname").value; lastname=document.getelementById("lastname").value; if(lastname==""){ alert('please enter lastname'); } } </script> <form action="" method="post" onSubmit="check();"> <input type="text" id="firstname" name="firstname" ><br> <input type="text" id="lastname" name="lastname" ><br> <input type="submit" value="submit"> </form> </body> </html>
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

El error en el código: mayúsculas y minúsculas getelEmentById. Por favor debajo del código y pruébalo

 function check(){ firstname=document.getElementById("firstname").value; lastname=document.getElementById("lastname").value; if(lastname==""){ alert('please enter lastname'); } }
about 4 years ago · Santiago Trujillo Report

0

GetElementById, elemento con E mayúscula
JavaScript distingue entre mayúsculas y minúsculas. CONSEJO: use las opciones de desarrollador en su navegador. Suelen dar un mensaje de error.

 <!DOCTYPE html> <script> function check(){ firstname=document.getElementById("firstname").value; lastname=document.getElementById("lastname").value; if(lastname==""){ alert('please enter lastname'); } } </script> <form action="" method="post" onSubmit="check();"> <input type="text" id="firstname" name="firstname" ><br> <input type="text" id="lastname" name="lastname" ><br> <input type="submit" value="submit"> </form> </body> </html>

about 4 years ago · Santiago Trujillo 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!