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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:49:06+00:00 2026-05-19T15:49:06+00:00

Hi im trying to load a div next to an link/button if clicked by

  • 0

Hi im trying to load a div next to an link/button if clicked by unauthenticated users.

i have the following:

$(function () {

    $(".unauthenticated").click(function () {
        ShowMessage($(this).attr("id"), "#unauthenticated-div")
    });

    function ShowMessage(clickedItemId, divId) {

        clickedItem = $("#" + clickedItemId);
        var pos = clickedItem.offset();
        var width = clickedItem.width();

        $(divId).css({
            "left": pos.left + width + 10,
            "top": pos.top + 10
        }).show();
    }
});

<div id="unauthenticated-div" title="Please Login" style="display: none;">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;">
    </span>You must <a href="#" id="login-link">login</a>or <a href="/Account/Register/">Register</a>to do this</p>
</div>

It shown the div, but not next to the clicked link. when i step through the code, pos and width are as expected.

  • 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-19T15:49:07+00:00Added an answer on May 19, 2026 at 3:49 pm

    Does the element on which you’re setting the position have its position property set to absolute or relative?

    If not, try setting it.

        $(divId).css({
            "left": pos.left + width + 10,
            "top": pos.top + 10,
            "position":"absolute"
        }).show();
    

    Also, your updated question with the HTML doesn’t show an element with the class "unauthenticated".

    Not sure if that’s part of the issue, but the click is being assigned to $(".unauthenticated").

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

Sidebar

Related Questions

I'm trying to load a DIV element from an external page into my current
I am trying to use load() to place some html into a div on
I have a problem with out of memory when I'm trying load a few
I'm trying to load fragments of XHTML markup using jQuery's $.fn.load function, but it
I have this html structure: <div id=home> <div class=section_header> <h1 class=left data-target=newest><?=lang('home_newest');?></h1> ... </div>
I have a div with an id called #wrapper . Next to it I
I am trying to load a div from another domain and display it on
xmlDoc.load(cd_catalog.xml) var cd=xmlDoc.getElementsByTagName(CD); var id_set=1; var id=xmlDoc.getElementsByTagName(ID+id_set); i=0; function next() { if (i<id.length-1) {
I am trying to load a div into my page (it is an iteration
I am trying to load a div into my page (it is an iteration

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.