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

查看所有标签

Beginning ASP.NET 4 in C# and Vb

Beginning ASP.NET 4 in C# and Vb

Imar Spaanjaars / Wrox / 2010-3-19 / GBP 29.99

This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to ......一起来看看 《Beginning ASP.NET 4 in C# and Vb》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器