What makes you think that the only way to focus on something is by clicking
on it?

I would aproach your problem from a different angle. I would ask the
browser to give me whatever has the focus via document.activeElement:
https://developer.mozilla.org/en-US/docs/Web/API/document.activeElement
http://msdn.microsoft.com/en-us/library/ie/ms533065(v=vs.85).aspx

Or simply use the focus selector in jQuery:
http://api.jquery.com/focus-selector/


On Thu, Jan 30, 2014 at 2:15 PM, Rafael Barrera Oro <boraf...@gmail.com>wrote:

> Hello everyone!
>
> I'm trying to to mantain the focus of the last component that was clicked
> regardless of the refresh of part of the page when certain text field
> changes. The problem i have is that the onchange event is always fired
> before the onclick method, and this causes that the latter is either fired
> over the wrong component or not fired at all, is there a way to delay the
> onchange event until after the onclick event takes place?
>
> My goal is to use the onclick event to save the id of the clicked
> component, then let the onchange event do its thing (refresh a part of the
> page which maybe includes the clicked component).
>
> Has anyone achieved something similiar and/or has any ideas?
>
> Thanks in advance!
> Rafael
>

Reply via email to