run function bind to event code example
Example 1: jquery bind click
$( "#foo" ).bind( "click", function() {
alert( "User clicked on 'foo.'" );
});
Example 2: bind jquery
/* As of jQuery 3.0, .bind() has been deprecated.
It was superseded by the .on() method, as presented in the exemple below */
$("#foo").on("click", function(){
alert("User click on foo");
});