1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    141
    Vote Rating
    0
    armandoxxx is on a distinguished road

      0  

    Default Get focused element in a form

    Hey

    Is there a way to get focused element in a form ?

    Regards

    Armnado

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,334
    Vote Rating
    87
    sword-it is just really nice sword-it is just really nice sword-it is just really nice sword-it is just really nice

      0  

    Default get active element of your document

    Hi!

    Use document.activeElement, it is supported in all major browsers.

    For more details on document.activeElement browser compatibility, check this https://developer.mozilla.org/en/DOM..._compatibility


    If You are not still getting document.activeElement in your form, try to do following:-

    Code:
    if (!document.activeElement) { 
        //Step 1:- Add a "focus" event handler to all fields .
        //Step 2:- Record the last-focused field in a variable. 
        //Step 3:- Add a "blur" handler to clear the variable upon a blur event for the last-focused field.
    }
    Last edited by sword-it; 24 May 2012 at 10:52 PM. Reason: misspelling
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Thread Participants: 1