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://www.codercto.com/courses/l/35.html

查看所有标签

Web Security Testing Cookbook

Web Security Testing Cookbook

Paco Hope、Ben Walther / O'Reilly Media / 2008-10-24 / USD 39.99

Among the tests you perform on web applications, security testing is perhaps the most important, yet it's often the most neglected. The recipes in the Web Security Testing Cookbook demonstrate how dev......一起来看看 《Web Security Testing Cookbook》 这本书的介绍吧!

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具