Home  >  Article  >  Web Front-end  >  Sharing multiple ways of writing how jquery calls the click event

Sharing multiple ways of writing how jquery calls the click event

黄舟
黄舟Original
2017-06-27 09:53:491855browse

The 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 way The method is only applicable to versions above jquery 1.7

The source code is as follows:


















The above is the detailed content of Sharing multiple ways of writing how jquery calls the click event. 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