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

查看所有标签

Struts 2 in Action

Struts 2 in Action

Don Brown、Chad Davis、Scott Stanlick / Manning Publications / 2008.3 / $44.99

The original Struts project revolutionized Java web development and its rapid adoption resulted in the thousands of Struts-based applications deployed worldwide. Keeping pace with new ideas and trends......一起来看看 《Struts 2 in Action》 这本书的介绍吧!

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

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具