is it possible to trigger a click with jQuery that works cross browser?
html:
<a id="go-societe" href="#societe" class="societetrigger" >Societe</a>
works in firefox but doesn’t work in IE and chrome:
$('a.societetrigger')[0].click();
doesn’t work in firefox, IE and chrome:
$('a.societetrigger').click(function(){
$('a.societetrigger').click();
});
Yes you just need to use jQuery…
$('a.societetrigger')[0]is a DOM element not a jQuery object, thus it won’t work, if you want only the first element wrap it with$():or use the jQuery
firstfunction:The second code which doesn’t work in all the browsers, Attaches callback function to the
clickevent which will trigger the click event… Does it sounds reasonable to you? to me it sounds like an infinite loop.