Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7089467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:55:31+00:00 2026-05-28T07:55:31+00:00

I am trying to create a Jquery Tree plugin for my current project. In

  • 0

I am trying to create a Jquery Tree plugin for my current project. In the plugin, there are 3 compomnents: a text box containing the result selected from the tree , a div containing the tree and a button to show the div. It works fine, except that i cannot make it auto lose the popup div if the tree lose its focus.

Here is the code to create the div

 createTree = function() {
        $.getJSON(_options.jsonSrc, function(data) {
            nDiv = document.createElement("div");
            nDiv.id = "divRootAd";
            $(nDiv).css('display', 'none');

            jsonObj = data["treeJson"];

            nUl = document.createElement("ul");
            nUl.appendChild(createNode(jsonObj));

            nDiv.appendChild(nUl);  

            $("body").append(nDiv);
            //$(nDiv).focus();

            repositionDiv();
        });
    };

repositionDiv = function() {
        if ($('#divRootAd').is(':hidden')) {
            // get the field position
            var sf_pos    = $("#txtAdVal").offset();
            var sf_top    = sf_pos.top;
            var sf_left   = sf_pos.left;        

            // get the field size
            var sf_height = $("#txtAdVal").height();

            // apply the css styles - optimized for Firefox
            $("#divRootAd").css("position","absolute");
            $("#divRootAd").css("left", sf_left);
            $("#divRootAd").css("top", sf_top + sf_height + 5);


            $('#divRootAd').show();

            $('#divRootAd').blur(function(event){
                alert("lose focus");

                clearDiv();
            });


        } else {
            clearDiv();
        }
    };

The line alert(“lose focus”) does not work when i move the mouse outside the div. Can anyone suggest a solution for this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:55:31+00:00Added an answer on May 28, 2026 at 7:55 am

    Instead of blur you could use mouseout

    
    $('#divRootAd').mouseout(function(event){
        alert("lose focus");
        clearDiv();
    });
    
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a jquery treeview plugin for my current project. Plugin
I am trying to create a jquery plugin to do ajax table pagination (i.e
I'm am trying to create a jQuery plugin that will add new namespace functions
i'm trying to create my first jQuery plugin. i got a prototype function called
I'm trying to create a jQuery plugin, inside I need to do an AJAX
I am trying to create a JQuery Autocomplete box where the words being suggested
i'm trying to create my own jquery plugin but am having problems bubbling the
I'm trying to create a jQuery plugin and having problems with selecting the DOM.
I'm trying to create a jQuery widget which extends from ui.slider . I'd like
I am trying to create a jquery plugin, and I want have the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.