Home > Web Front-end > JS Tutorial > A brief analysis of the on() method of jQuery events to bind multiple selectors and multiple events_jquery

A brief analysis of the on() method of jQuery events to bind multiple selectors and multiple events_jquery

WBOY
Release: 2016-05-16 15:03:31
Original
1496 people have browsed it
$(document).on('click', '#header .top, #main .btn', function () {
   // code...
 });
Copy after login

The on() method binds multiple events

$("table.planning_grid").on({
  mouseenter: function() {
    // Handle mouseenter...
  },
  mouseleave: function() {
    // Handle mouseleave...
  },
  click: function() {
    // Handle click...
  }
}, "td");
Copy after login

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'); 
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template