Home  >  Article  >  Web Front-end  >  JavaScript determines whether the textarea value is empty and gives corresponding prompts_javascript tips

JavaScript determines whether the textarea value is empty and gives corresponding prompts_javascript tips

WBOY
WBOYOriginal
2016-05-16 16:37:151919browse

In web design, we often use JavaScript to determine whether the user has entered legal data. If the user does not enter data, a corresponding prompt will be given. So how to judge? Here we introduce to you how to use JavaScript to determine whether the textarea value is empty.

The JavaScript function is given below:

if(document.getElementById("htmer").value==''){alert("请输入内容!");return false;}

Note that the red part =='' in the above code is a single quote instead of a double quote, which can reduce a lot of unnecessary trouble.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn