jQuery mouse event click event

Among interactive operations, the simplest and most direct operation is the click operation.

jQuery provides two methods. One is the click method to monitor the user's click operation, and the other method is the dbclick method to monitor the user's double-click operation.

The usage of these two methods is similar. The following takes the click() event as an example.

It is very simple to use: $('').click()

Let's take a look at an example

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>事件</title>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
    <input type="button" value="click">

    <script>
        $("input").click(function(){
            alert("触发点击事件");
        })
    </script>
</body>
</html>

As shown in the above code, we can see that we have created a click event for the button. You can try it locally

Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>事件</title> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <input type="button" value="click"> <script> $("input").click(function(){ alert("触发点击事件"); }) </script> </body> </html>
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!