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

111
Views
¿Hay alguna forma de detectar si un usuario no ha respondido una entrada?

Estoy creando un selector de nombres y quiero detectar si su usuario ha ingresado un nombre o si simplemente está jugando con el sitio web. ¿Hay alguna forma de hacer esto? Código:

 <html> <textarea id="names"></textarea> <input type="submit" value="Pick" onclick="onClick(this)"> <p id="chosen"></p> </html> <script> function onClick(x) { //Your code } </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Se llama al método getNames() para que el elemento <input> verifique el valor cuando se envía, y se devuelve un valor después de verificar el valor dentro del elemento <textarea> .

 /* This helper method checks whether the login has been made or not. */ function isNameEmpty(){ var name = document.getElementById("names"); if(name.value.length != 0){ console.log(name.value); return false; } else{ console.log('No value was entered.'); return true; } } /* This submit method is used to return the entered name. */ function getNames(){ if(!isNameEmpty()){ return document.getElementById("names").value; } else{ alert('No value was entered.'); return ''; } }
 <textarea id="names"></textarea> <input type="submit" value="Pick" onclick="return getNames();"> <p id="chosen"></p>


Referencias
  • Agregue la función onclick a un botón de envío
about 4 years ago · Juan Pablo Isaza Report

0

puede cambiar el área de texto a la etiqueta de entrada y puede usar atributos integrados en el navegador como tipo = longitud mínima máxima del texto, etc.

de lo contrario, debe escribir una función que lea y evalúe el valor de entrada del área de texto

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!