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

  • Home
  • SEARCH
  • 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 6026493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:27:10+00:00 2026-05-23T04:27:10+00:00

I have this HTML: <html> <body> <div id=pgContent> <div id=studyOverlay> <div id=studyContainer> <div id=studyTest>

  • 0

I have this HTML:

<html>
    <body>
        <div id="pgContent">
            <div id="studyOverlay">
                <div id="studyContainer">
                    <div id="studyTest">
                        <div id="studyTestContainer">
                            <input class="dropInput">
                            <ul class="inputDrop">
                            <!--some <li>s-->
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>

I want to use jQuery to position the <ul> directly underneath the <input>. This HTML shows only one input and ul, but there can be multiple with the same classes.

I tried this jQuery:

$('.dropInput').live('click', function() {
var offset = $(this).offset();
var height = $(this).height();
var width = $(this).width();
var top = offset.top + height + "px";
var right = offset.left + width + "px";

$(this).next().show();

$(this).next().css( {
    'position': 'absolute',
    'right': right,
    'top': top
});
});

but it positions it very strangely. My guess is that there is something with the offset and there being so many divs. Is there any way to fix this?

Or if you know a CSS way that would be even better!

  • 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-23T04:27:11+00:00Added an answer on May 23, 2026 at 4:27 am

    I seemed to be able to do it with just css here:

    http://jsfiddle.net/maniator/AfJUG/

    Sample css:

    div {
        padding: 10px;
        background: blue;
    }
    
    
    #studyTestContainer {
        background: red;
    }
    

    That seems to do it, unless I am misunderstanding the issue at hand.


    UPDATE:

    JS:

    $('.dropInput').focus(function(){
        $(this).next('.inputDrop').slideDown();
    }).blur(function(){
        $(this).next('.inputDrop').slideUp();
    });
    

    CSS:

    div {
        padding: 10px;
        background: blue;
    }
    
    
    #studyTestContainer {
        background: red;
    }
    
    .inputDrop {
        display: none;
    }
    
    .dropInput {
        display: block;
    }
    

    Fiddle: http://jsfiddle.net/maniator/AfJUG/6/


    New Fiddle based on comments below: http://jsfiddle.net/maniator/AfJUG/7/


    And another: http://jsfiddle.net/maniator/AfJUG/9/

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

Sidebar

Related Questions

For example I have this HTML: <body> <div>Text</div> </body> And I would like to
I need to get content for this XPath: /html/body/div/table[2]/tbody/tr/td[2] It's copied from FireBug. How
I have a string containing HTML and I need to be able to access
I need some help with my xpath query. I can get this code to
I'm hoping that someone else has experienced this and can point me in the
I have created an AJAX based app. It's working perfect when I use my
I have had a few issues with HtmlUnit returning nulls lately and am looking
I'm making a web scraper and this is driving me crazy! I need to
I am very sorry. This is follow up for my question here : Why
I am coding with Groovy, however, I don't believe its a language specific set

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.