jQuery event.data 属性

jQuery 教程 · 2019-03-10 22:13:32

实例

对每个 <p> 元素返回通过 on() 方法传递的数据:

$("p").each(function(i){
    $(this).on("click",{x:i},function(event){
        alert("序号:" + $(this).index() + ". 段落的数据为: " + event.data.x);
    });
});

定义和用法

event.data 属性包含当前执行的处理程序被绑定时传递到事件方法的可选数据。

语法


event.data

参数 描述
event 必需。event 参数来自事件绑定函数。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Introduction to Linear Optimization

Introduction to Linear Optimization

Dimitris Bertsimas、John N. Tsitsiklis / Athena Scientific / 1997-02-01 / USD 89.00

"The true merit of this book, however, lies in its pedagogical qualities which are so impressive..." "Throughout the book, the authors make serious efforts to give geometric and intuitive explanations......一起来看看 《Introduction to Linear Optimization》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具