Home >Web Front-end >JS Tutorial >A brief analysis of the on() method of jQuery events to bind multiple selectors and multiple events_jquery
$(document).on('click', '#header .top, #main .btn', function () { // code... });
The on() method binds multiple events
$("table.planning_grid").on({ mouseenter: function() { // Handle mouseenter... }, mouseleave: function() { // Handle mouseleave... }, click: function() { // Handle click... } }, "td");
Use the on() method to bind multiple selectors and multiple events
$(document).on({ mouseenter: function() { // Handle mouseenter... }, mouseleave: function() { // Handle mouseleave... }, click: function() { // Handle click... } }, 'click', '#header .top, #main .btn');
The above article briefly analyzes the on() method of jQuery events to bind multiple selectors. Multiple events are all the content shared by the editor. I hope it can give you a reference, and I also hope that everyone will support the script. Home.