♦ jQuery on()
♣ Example8: jQuery on()
The on() method can be used when we want multiple(including single) event handling to be attached.This is a many-to-many relation between events and actions.
Below is the representation of on() Syntax.
Basic Syntax
$(selector).on(function(){
//code_block
})
//code_block
})
Syntax Explanation:
selector : element selector for event to be performed
code_block : code for execution, which will execute when event is performed
In this example, .code_block : code for execution, which will execute when event is performed
Example
Input:
Output: