Home > Web Front-end > JS Tutorial > 3 ways to write JQuery to call and bind click events_jquery

3 ways to write JQuery to call and bind click events_jquery

WBOY
Release: 2016-05-16 16:07:20
Original
1294 people have browsed it

First way:

 $(document).ready(function(){
 $("#clickme").click(function(){
    alert("Hello World click");
 });
Copy after login

The second way:

 $('#clickmebind').bind("click", function(){
 alert("Hello World bind");
 });
Copy after login

The third way:

$('#clickmeon').on('click', function(){ 
 alert("Hello World on"); 
}); 
}); 
Copy after login

Note: The third method is only applicable to jquery 1.7 or above
The source code is as follows:













Copy after login

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