JavaScript determines whether the textarea value is empty and prompts for it

  • 2020-03-30 03:54:45
  • OfStack

We often use JavaScript in web design to determine whether the user is entering legitimate data, if the user does not enter data to give the corresponding prompt, so how to determine? Here's how to use JavaScript to determine if a textarea value is empty.

The following JavaScript functions are given:


if(document.getElementById("htmer").value==''){alert(" Please enter the content !");return false;}

Note that the red part of the code above == "" is a single quotation mark instead of a double quotation mark, which saves a lot of unnecessary trouble.


Related articles: