📅  最后修改于: 2020-11-26 01:34:58             🧑  作者: Mango
jQuery bind()事件用于为一组元素中的选定元素附加一个或多个事件处理程序。它指定事件发生时要运行的函数。
它通常与jQuery的其他事件一起使用。
句法:
$(selector).bind(event,data,function,map)
Parameter | Description |
---|---|
Event | It is a mandatory parameter. It specifies one or more events to attach to the elements. If you want to add multiple events they they must be separated by space. |
Data | It is an optional parameter. It specifies additional data to pass along to the function. |
Function | It is a mandatory parameter. It executes the function to run when the event occurs. |
Map | It specifies an event map which contains one or more events or functions attached to the element. |
让我们以一个示例来演示jQuery bind()事件。
Click on the statement.
输出:
Click on the statement.
让我们以带有mouseenter()和mouseleave()事件的jQuery bind()为例。
bind demo
Click or double click on the statement.