On my site, I have a div
container, which contains a <input>
, and a <a onclick="DoSomeStuff();" href="#" target="_blank">
element, which acts as a button. Now, DoSomeStuff();
modifies the href
attribute based on the value of the input
element.
I need to emulate click on this anchor tag after user pressed enter on an input
element. I know how to detect this enter, but I don't know how to click this anchor. jQuery's .click()
is not working in here, it only fires onclick()
of the anchor tag, but does not actually click the anchor.
Edit: Here is an example on what I want to do: http://jsfiddle.net/JZYWZ/. It triggers the onclick
event of the anchor tag, but does not follow the link in new tab.