1$( "#foo" ).bind( "click", function() {
2 alert( "User clicked on 'foo.'" );
3});
4
1/* As of jQuery 3.0, .bind() has been deprecated.
2It was superseded by the .on() method, as presented in the exemple below */
3
4$("#foo").on("click", function(){
5 alert("User click on foo");
6});
7
1$(document).ready(function() { // attach a handler to an event for the elements
2$("#demo").bind('blur', function(e) {
3 //dom event fired
4});
5});
6