I want to simulate a user clicking on an <a> themselves. After grabbing the and alerting the contents I was expecting [object], but instead I get the href content! I’m not using jQuery.
Link
<a href="javascript:showExplorerTab();" id="lnk_blend_explorer" onFocus="this.blur();">Blend</a>
Javascript
var o = document.getElementById("lnk_blend_explorer");
alert(o);
o.click();
Alert shows … javascript:showExplorerTab(); … and not … [object]
Why is this happening?
All
<a href>elements have atoString()method that returns their href attribute. Don’t ask me why, that’s just how it works.