I was wondering why Jquery.onClick() won't let you follow links and open new windows.
I tried to "simulate" a click on a link like here but it won't work. Why?
$('#link').click();
Example: http://jsfiddle.net/wCRLE/5/
I was wondering why Jquery.onClick() won't let you follow links and open new windows.
I tried to "simulate" a click on a link like here but it won't work. Why?
$('#link').click();
Example: http://jsfiddle.net/wCRLE/5/
That would trigger any click event listeners you've added to the element, not trigger the native functionality.
You could do something similar by doing this:
window.open($('#link').attr('href'));
Example: http://jsfiddle.net/wCRLE/8/
On a side note, it's a good idea to avoid defining your click events inline with your HTML tag. I've modified your jsFiddle to show how you could do it using jQuery.