Home >Web Front-end >JS Tutorial >In addition to alert, what other prompt methods are there in js?

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

一个新手
一个新手Original
2017-09-09 09:18:274403browse

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!

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