Is there any way to find out which asp.net component has focus by using a server or client script?
            Asked
            
        
        
            Active
            
        
            Viewed 5,353 times
        
    3 Answers
2
            
            
        Definitely not using a server script. It's very important to understand that your server code does not run on an "active" page. ASP.Net Server code only prepares html to send to the browser before the user sees it — even on a post back it's recreating the entire html page from scratch.
Client javascript is another story: you can handle the onfocus event for any element you care about.
 
    
    
        Joel Coehoorn
        
- 399,467
- 113
- 570
- 794
0
            
            
        How do I find out which Javascript element has focus?
If the requirement is for IE only you can use
document.activeElement
 
     
     
     
    