Home > Web Front-end > JS Tutorial > body text

In addition to alert, what other prompt methods are there in js?

一个新手
Release: 2017-09-09 09:18:27
Original
4359 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template