Home > Web Front-end > JS Tutorial > body text

Sharing multiple ways of writing how jquery calls the click event

黄舟
Release: 2017-06-27 09:53:49
Original
1859 people have browsed it

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

The source code is as follows:
















Copy after login



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!

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