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 9064697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:19:11+00:00 2026-06-16T16:19:11+00:00

I am trying to create div elements and print items on to them dynamically.

  • 0

I am trying to create div elements and print items on to them dynamically. I’ve created a demo to show where I’ve reached.

The issue with my code is that it doesn’t show up right next to the list where I want it. Instead it is displayed at the bottom. Is it possible to show the new div right next to the element that I’m hovering over?

$(".bubble").live({
    mouseenter : function() {
        $("#bubble").show();
        $("#bubble").html($(this).attr('id'));
    },
    mouseleave : function() {
        $("#bubble").empty();
    }
});
#bubble{
    width:100px;
    height:20px;
    background-color:#666666;
    position:absolute;
    display:hidden;
}
<ul>
    <li><span class="bubble" id="test1">test1</span></li>
    <li><span class="bubble" id="test2">test2</span></li>
    <li><span class="bubble" id="test3">test3</span></li>
    <li><span class="bubble" id="test4">test4</span></li>
    <li><span class="bubble" id="test5">test5</span></li>
</ul>
<div id="bubble"></div>
  • 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-06-16T16:19:12+00:00Added an answer on June 16, 2026 at 4:19 pm

    You need to set the position of #bubble relative to the li which is being moused over. Try this:

    $("ul").on('hover', '.bubble', function(e) {
        if (e.type == 'mouseenter') {
            var $el = $(this);
            $("#bubble")
                .html($el.attr('id'))
                .css({
                    top: $el.offset().top,
                    left: $el.offset().left + $el.width()
                })
                .show();
        }
        else {
            $("#bubble").empty();
        }
    });
    

    Example fiddle

    Note that I have removed the use of live() as it has been deprecated, and used on() with a delegate instead. Also I used the hover event.

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

Sidebar

Related Questions

I'm trying to create two side-by-side div elements, but I found that having an
I'm trying to create an element(div) on keyup of the space key (key-code 32).
I'm trying to replace a div with created elements, going from: <div id='links'></div> to
I'm trying to create a standardized show/hide element system, like so: <div class=opener popup_1>Click
I'm trying to create the illusion of a multiselect dropdown using a div that
I'm trying to create a web form that contains checkboxes, among other input elements,
I am trying to create a div that slants only at the top and
I have been trying to create a form that having 4 elements. One is
We're trying to create an HTML page that consists of masonry-style floated elements that
I have a div with child divs that I'm trying to create a slideshow

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.