jQuery - trigger('click') not working in IE - Object does not support this property or method

areid picture areid · Jun 27, 2011 · Viewed 12.6k times · Source

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?

Answer

malko picture malko · Jun 27, 2011

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