Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 16:07:201236browse

First way:

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

The second way:

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

The third way:

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

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
















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