The reason being, the JS resource was added to the DOM, some 30-40 lines above where the call to the jQuery CDN was. And because source order matters, the little button script had nothing to work with when it was executed.
In the end I did a less ideal but practical route and put a click handler on the link around the button. Mostly because I didn't want to reposition the jQuery request in our production site.
Code:
<a href="internal link to page#top" onclick="javascript:document.getElementsByName('Search').focus(); return false;">
<button> blah blah </button>
</a>
Leave a comment: