We can combine multiple events and run the same code. Each event has to be separated by a space.
$('#id_dtl').bind('blur keyup', function(){
// Your code here
});
Here either blur or keyup any one event can fire the code inside.
How to identify which event has occurred
We can use e.type to get the details of the event.
$("#b1").on('dblclick click',function(e){
$("#t1").html('Your type of Click event : '+e.type);
});
Practice Questions
Welcome Message should display on click of a button
Use timer to remove the message after 2 seconds.
I have three radio buttons to select one of the available sections, display a message saying welcome to that particular section once the user clicks any radio button. ( Hint : Use common class for all three radio buttons ).
Display welcome message on Double click of a button. Create another trigger to display different message for a single click.
In above code use one single function to display common message for double click or single click on a button.
Create one textarea and count the number of chars entered by the user. The counter should increase or decrease as the user type chars or delete chars inside the texterea.