Home >Web Front-end >JS Tutorial >In addition to alert, what other prompt methods are there in js?
For page errors, the easiest thing to think of is to use alert to prompt. However, too many alerts are easily annoying. You can do the following
<input id="myname" name="myname" > <p id="errormessage" style="color:red"></p> <script> function check(){ if(${"#myname"}.val()==""){ $("#errormessage").text("你的名字为必填项!"); return false; } return true; } </script>
The above is the detailed content of In addition to alert, what other prompt methods are there in js?. For more information, please follow other related articles on the PHP Chinese website!