jQuery $.proxy() 方法 jQuery 事件方法 实例 强制执行 objPerson 内的 "test" 函数的上下文: $("button").click($.proxy(objPerson,"test")); 尝试一下 » 定义和用法 $.proxy 方法接受一个已有的函数,并返回一个带特定上下文的新的函数。 该方法...
https://www.w3cschool.cn/jquery/event-proxy.htmljQuery live() 方法 jQuery 事件方法 实例 当点击按钮时,隐藏或显示 <p> 元素: $("button").live("click",function(){ $("p").slideToggle(); }); 尝试一下 » 定义和用法 live() 方法在 jQuery 版本 1.7 中被废弃,在版本 1.9 中被移除。请使用 on() ...
https://www.w3cschool.cn/jquery/event-live.htmljQuery event.namespace 属性 jQuery 事件方法 实例 添加并移除自定义命名空间: $("p").on("custom.someNamespace",function(event){ alert(event.namespace); });$("p").click(function(event){ $(this).trigger("custom.someNamespace"); }); $("button").click(function(){ $("p").off("custom...
https://www.w3cschool.cn/jquery/event-namespace.htmljQuery event.delegateTarget 属性 jQuery 事件方法 实例 改变 <div> 元素的背景颜色(<button> 元素的祖先): $("div").on("click","button",function(event){ $(event.delegateTarget).css("background-color", "pink");}); 尝试一下 » 定义和用法 event.delegate...
https://www.w3cschool.cn/jquery/event-delegatetarget.htmljQuery bind() 方法 jQuery 事件方法 实例 向 <p> 元素添加一个单击事件: $("p").bind("click",function(){ alert("The paragraph was clicked.");}); 尝试一下 » 定义和用法 bind() 方法向被选元素添加一个或多个事件处理程序,以及当事件发生时...
https://www.w3cschool.cn/jquery/event-bind.htmljQuery error() 方法 jQuery 事件方法 实例 如果 image 元素遇到错误,把它替换为文本: $("img").error(function(){ $("img").replaceWith("<p>Error loading image!</p>");}); 尝试一下 » 定义和用法 error() 方法在 jQuery 版本 1.8 中被废弃。 当元...
https://www.w3cschool.cn/jquery/event-error.htmljQuery die() 方法 jQuery 事件方法 实例 移除所有通过 live() 方法向 <p> 元素添加的事件处理程序: $("p").die(); 尝试一下 » 定义和用法 die() 方法在 jQuery 版本 1.7 中被废弃,在版本 1.9 中被移除。请使用 off() 方法代替。 die() ...
https://www.w3cschool.cn/jquery/event-die.htmljQuery delegate() 方法 jQuery 事件方法 实例 当单击 <div> 元素内部的 <p> 元素时,改变所有 <p> 元素的背景颜色: $("div").delegate("p","click",function(){ $("p").css("background-color","pink"); }); 尝试一下 » 定义和用法 delegate() 方法...
https://www.w3cschool.cn/jquery/event-delegate.htmljQuery element ~ siblings 选择器 jQuery 选择器 实例 选取 <div> 元素同级的所有 <p> 元素: $("div ~ p") 尝试一下 » 定义和用法 ("element ~ siblings") 选择器选取指定元素 "element" 同级的所有元素。 比如: $("div ~ p") - 选取 <div&...
https://www.w3cschool.cn/jquery/sel-previous-siblings.htmljQuery element + next 选择器 jQuery 选择器 实例 选取与每个 <div> 元素相邻的下一个 <p> 元素: $("div + p") 尝试一下 » 定义和用法 ("element + next") 选择器选取指定元素 "element" 的下元素 "next"。"next" 元素必须置于指定元素 "el...
https://www.w3cschool.cn/jquery/sel-previous-next.html抱歉,暂时没有相关的微课
w3cschool 建议您:
抱歉,暂时没有相关的视频课程
w3cschool 建议您:
抱歉,暂时没有相关的教程
w3cschool 建议您:
jQuery $.proxy() 方法 jQuery 事件方法 实例 强制执行 objPerson 内的 "test" 函数的上下文: $("button").click($.proxy(objPerson,"test")); 尝试一下 » 定义和用法 $.proxy 方法接受一个已有的函数,并返回一个带特定上下文的新的函数。 该方法...
https://www.w3cschool.cn/jquery/event-proxy.htmljQuery live() 方法 jQuery 事件方法 实例 当点击按钮时,隐藏或显示 <p> 元素: $("button").live("click",function(){ $("p").slideToggle(); }); 尝试一下 » 定义和用法 live() 方法在 jQuery 版本 1.7 中被废弃,在版本 1.9 中被移除。请使用 on() ...
https://www.w3cschool.cn/jquery/event-live.htmljQuery event.namespace 属性 jQuery 事件方法 实例 添加并移除自定义命名空间: $("p").on("custom.someNamespace",function(event){ alert(event.namespace); });$("p").click(function(event){ $(this).trigger("custom.someNamespace"); }); $("button").click(function(){ $("p").off("custom...
https://www.w3cschool.cn/jquery/event-namespace.htmljQuery event.delegateTarget 属性 jQuery 事件方法 实例 改变 <div> 元素的背景颜色(<button> 元素的祖先): $("div").on("click","button",function(event){ $(event.delegateTarget).css("background-color", "pink");}); 尝试一下 » 定义和用法 event.delegate...
https://www.w3cschool.cn/jquery/event-delegatetarget.htmljQuery bind() 方法 jQuery 事件方法 实例 向 <p> 元素添加一个单击事件: $("p").bind("click",function(){ alert("The paragraph was clicked.");}); 尝试一下 » 定义和用法 bind() 方法向被选元素添加一个或多个事件处理程序,以及当事件发生时...
https://www.w3cschool.cn/jquery/event-bind.htmljQuery error() 方法 jQuery 事件方法 实例 如果 image 元素遇到错误,把它替换为文本: $("img").error(function(){ $("img").replaceWith("<p>Error loading image!</p>");}); 尝试一下 » 定义和用法 error() 方法在 jQuery 版本 1.8 中被废弃。 当元...
https://www.w3cschool.cn/jquery/event-error.htmljQuery die() 方法 jQuery 事件方法 实例 移除所有通过 live() 方法向 <p> 元素添加的事件处理程序: $("p").die(); 尝试一下 » 定义和用法 die() 方法在 jQuery 版本 1.7 中被废弃,在版本 1.9 中被移除。请使用 off() 方法代替。 die() ...
https://www.w3cschool.cn/jquery/event-die.htmljQuery delegate() 方法 jQuery 事件方法 实例 当单击 <div> 元素内部的 <p> 元素时,改变所有 <p> 元素的背景颜色: $("div").delegate("p","click",function(){ $("p").css("background-color","pink"); }); 尝试一下 » 定义和用法 delegate() 方法...
https://www.w3cschool.cn/jquery/event-delegate.htmljQuery element ~ siblings 选择器 jQuery 选择器 实例 选取 <div> 元素同级的所有 <p> 元素: $("div ~ p") 尝试一下 » 定义和用法 ("element ~ siblings") 选择器选取指定元素 "element" 同级的所有元素。 比如: $("div ~ p") - 选取 <div&...
https://www.w3cschool.cn/jquery/sel-previous-siblings.htmljQuery element + next 选择器 jQuery 选择器 实例 选取与每个 <div> 元素相邻的下一个 <p> 元素: $("div + p") 尝试一下 » 定义和用法 ("element + next") 选择器选取指定元素 "element" 的下元素 "next"。"next" 元素必须置于指定元素 "el...
https://www.w3cschool.cn/jquery/sel-previous-next.html