jQuery - trigger('click')在IE中不工作 - 对象不支持此属性或方法 [英] jQuery - trigger('click') not working in IE - Object does not support this property or method
问题描述
点击链接时,会打开一个带有内容的阴影框。我想要整个overlay div是可点击的,所以我用:
$(div.overlay ){
$(this).click(function(){
$('a#overlink')。trigger('click'); // shadowbox link的ID
$ b b return false;
});
});
它在FF,Safari和但是IE显示对象不支持此属性或方法错误。
有另一种方法来执行此操作或使用其他方法吗?
您使用哪个版本的ie?
我记得某些版本的IE不支持点击链接或按钮以外的对象:(
可以尝试使用mousedown事件作为解决方法
p>I have an images with a fading overlay div on hover which displays a text link within.
When the link is clicked it opens a shadowbox with content. I want the whole overlay div to be clickable so I used :
$("div.overlay").each(function(){
$(this).click(function(){
$('a#overlink').trigger('click'); // id of shadowbox link
return false;
});
});
It works fine in FF, Safari & Chrome but IE shows a 'Object doesn't support this property or method' error.
Is there another way of doing this or another method to use?
Which version of ie are you using ? I remember that some version of IE don't support clicking objects other than links or buttons :(
perhaps try with a mousedown event as a workaround
这篇关于jQuery - trigger('click')在IE中不工作 - 对象不支持此属性或方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!