jQuery event.namespace 属性

jQuery 教程 · 2019-03-10 23:28:10

实例

添加并移除自定义命名空间:

$("p").on("custom.someNamespace",function(event){
    alert(event.namespace);
});
$("p").click(function(event){
    $(this).trigger("custom.someNamespace");
});
$("button").click(function(){
    $("p").off("custom.someNamespace");
});

定义和用法

当事件被触发时,event.namespace 属性返回自定义命名空间。

该属性可被插件作者用来根据所使用的命名空间以不同的方式处理任务。

提示:对于 jQuery 而言,以下划线开始的命名空间会被保留。

语法


event.namespace

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

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

查看所有标签

Spring in Action

Spring in Action

Craig Walls / Manning Publications / 2011-6-29 / USD 49.99

Spring in Action, Third Edition has been completely revised to reflect the latest features, tools, practices Spring offers to java developers. It begins by introducing the core concepts of Spring and......一起来看看 《Spring in Action》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

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

UNIX 时间戳转换