Search code examples
javascriptjqueryeventsfocusjquery-events

JS / Jquery - Focusing to the next input field from the event.target


Trying to have it so when a link is clicked aside one input, it will hide that link and focus to the input field in the next div. I need to reference it with an event-target for other reasons.

If I change .focus(); to .val('blah'); it works, and other, more typical methods i.e. $('a').click(function() {... will do the job. Is this just a limitation of using event-target?

Here is a fiddle


Solution

  • Your mousedown event does'nt trigger the handler, you'll need to use click() instead.

    Something like this FIDDLE