Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with element focus detection

    So, i have a <div> containing an <input>, right?
    Now what i need to do is make a onmouseover function for the <div>,
    it doesn't matter what the function DOES, but i want an "if" statement in the function that will detect whether or not the <input> has focus.

    Anybody know how?

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,845
    Thanks
    21
    Thanked 157 Times in 148 Posts
    i want an "if" statement in the function that will detect whether or not the <input> has focus.
    Why do you want to detect if the input has focus? Usually, you either need to give focus to something, i.e.:
    Code:
    document.getElementById('yourInput').focus();
    ..or you want to remove focus from something:

    Code:
    document.getElementById('yourInput').blur();
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •