Home >Web Front-end >JS Tutorial >Sharing multiple ways of writing how jquery calls the click event
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!