我这样做:
$.each($( img ), function () {
this.unbind( onmouseover );
});
这不管用 为什么?
我这样做:
$.each($( img ), function () {
this.unbind( onmouseover );
});
这不管用 为什么?
尝试像下面,
$( img ).unbind( mouseover );
不需要循环。 并且它应该是 moususeover
而不是 onmouseover
<强度 > 假设: 强度 > 您正在使用 . bind
约束 mouseover
处理器
我不使用绑定 。 有些图像有粘附属性, 我想删除它们 。 我尝试$( img. removeAttr), 但它仍然不起作用 。
<强度 > 守则: 强度>
$( img ).on( mouseover , function () {
//Your code
});
以后可以通过 .off
- & gt; 解码
$( img ).off( mouseover );
(
$.each($( img ), function () {
$(this).removeAttr( onmouseover );
});
不需要 < a href=" "http://api.jquery.com/jQuery.each/" rel="nofollow"\\\\ code>$.each () 当jQuery元素收藏已经有一个内部" http://api.jquery.com/each/" rel="nofollow"\\\code>eq () 。
另外,在 jQuery 中, 您可以使用“ 菊花链” 清除处理器方法, 因为每个函数返回相同的收藏。 每个附加方法都有自己的除去方法配对, 所以相应使用 。
最后,删除 DOM 元素( 内线事件处理器) 上的处理器, 代之以无效或函数, 即 < code> return freed code > ;
这里的概念代码是:
$( img )
.unbind( mouseover ) //remove events attached with bind
.off( mouseover ) //remove events attached with on
.die( mouseover ); //remove events attached with live
.each(function(i,el){ //and for each element
el.onmouseover = null //replace the onmouseover event
});
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!