简体   繁体   English

jQuery-返回$(this)DOM元素

[英]jQuery - returning $(this) DOM Element

i'm using DD_Belated.png to save all IE6 users from seeing the madness of unsupported png. 我正在使用DD_Belated.png来保存所有IE6用户,避免看到不受支持的png的疯狂。

However, this great script takes either selector or DOM Element as parameter to it's only function to do it's magic and return working PNG to IE6. 但是,这个出色的脚本采用选择器或DOM元素作为参数,这是它发挥魔力并将有效的PNG返回IE6的唯一功能。

Me, being lazy programmer, did something like this: 我是一个懒惰的程序员,做了这样的事情:

$("img[src$=png], #search").each (
  function() { 
    DD_belatedPNG.fix( *what-here* ); 
});

SO, basically I need some jQuery function to return DOM Element from $(this) . 所以,基本上,我需要一些jQuery函数来从$(this)返回DOM Element。

BTW, neither $(this).get() , $(this).get(0) nor $(this)[0] does work in IE6 顺便说一句, $(this).get()$(this).get(0)$(this)[0]都不在IE6中工作

Thank you. 谢谢。

Edit : Once again, the problem was between monitor and seat - in me. 编辑 :再次,问题出显示器和座位之间 -在我身上。 There are two methods - one for selector string and one for DOM Element. 有两种方法-一种用于选择器字符串,另一种用于DOM元素。 I used the first one for both - and I thought I'm not passing good argument with this , so I began to look into different - well, I did not gave the right argument - It expected string... 我同时使用了第一个参数-我以为我没有this传递良好的论据,所以我开始研究不同的事物-嗯,我没有给出正确的论据-它期望使用字符串...

In your .each function, the "this" variable will be your DOM element. 在您的.each函数中,“ this”变量将是您的DOM元素。 Thus: 从而:

DD_belatedPNG.fix(this);

should do it. 应该这样做。

I'll add, sadly, that I've never gotten any IE6 PNG fixers to work, at least not really work. 可悲的是,我要补充一点,就是我从未得到过任何IE6 PNG修复程序的支持,至少没有真正起作用。

您是否尝试过DD_belatedPNG.fix(this);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM