Home > Article > Web Front-end > JavaScript determines whether the textarea value is empty and gives corresponding prompts_javascript tips
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.