Is there any way to determine the current focused control on a web page? I want to keep focused control before my ajax callback and restore it afterwards.
Can this be easily identified?
Thanks,
Aj
Using:
document.activeElement
This is not officially standardized ( it will be in HTML5 ), but most, if not all, support its modern browsers. It started in Internet Explorer so that all versions of IE support it. Firefox supports it with FF3. Chrome also supports it, and I assume that Safari too.
Many browsers now support document.activeElement .
Works in:
If you are using jQuery, you can solve this with the http://plugins.jquery.com/project/focused plugin
// elm is the DOM Element owning the focus or null if no // DOM Element has the focus var elm = jQuery.focused();
Try using document.activeElement .
Source: https://habr.com/ru/post/1300663/More articles:Subclass of the class. Why is mutual subclassing prohibited? - pythonIs ActiveMQ rollback mechanism supported by C # (openwire) and python (stomp) clients? - pythonHow to set rails_env for script or batch file - ruby | fooobar.comDoes F # have free functions? - functionHow do I do RPC in Perl with Catalyst? - perlOnline authentication solution - pythonMySQL Trigger for specific mysql user only - sqlControlling FPU behavior in OpenMP? - c ++Help me convert a C ++ structure to C # - c ++Embedding IronPython in a C # application - import error on urllib - c #All Articles