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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:49:09+00:00 2026-05-15T14:49:09+00:00

I want to show a jquery dialog next to a button when its clicked.

  • 0

I want to show a jquery dialog next to a button when its clicked.

i have:

<input type="button" name="test" value="i" 
onclick="$('<div></div>').html('test message').dialog(
{title: 'Test Dialog',modal: false, width: 200, height:140, resizable:false});" 
/>

i dont think I can make a function call within a json definition?

I can get the location of the mouse using jquery (from the event) and i am happy to use that as display position or the position of the button.

any suggestions welcome.

  • 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-15T14:49:10+00:00Added an answer on May 15, 2026 at 2:49 pm

    First, if possible do this outside your markup, it’s much easier, so this:

    <input type="button" name="test" value="i" 
    onclick="$('<div></div>').html('test message').dialog(
    {title: 'Test Dialog',modal: false, width: 200, height:140, resizable:false});" 
    />
    

    Would be:

    <input type="button" name="test" value="i" />
    

    With this script:

    $(function() {
      $("input[name='test']").click(function() {
        $('<div></div>').html('test message')
           .dialog({title: 'Test Dialog',
                    modal: false, 
                    width: 200, 
                    height:140, 
                    resizable:false});
      });
    }); 
    

    Then we can add positioning, say you want it to the right of the button, then use .offset() to get the button’s position, then add it’s .outerWidth() to make it appear on the right, like this:

    $(function() {
      $("input[name='test']").click(function() {
        var pos = $(this).offset(),
            top = pos.top - $(document).scrollTop(); //minus amount scrolled down
        $('<div></div>').html('test message')
           .dialog({title: 'Test Dialog',
                    modal: false, 
                    width: 200, 
                    height:140, 
                    position: [pos.left + $(this).width(), top],
                    resizable:false});
      });
    }); 
    

    You can try an example here, it has the exact markup and code that I have above, and here’s a test version to ensure it works with scrolling.

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

Sidebar

Related Questions

For example, I want to show a jQuery dialog after insert or edit a
I'm using jquery dialog and want to slide on show. How do I specify
I want to show a JQuery dialog conditionally on click event of an hyperlink
I'm new to jQuery, and now I want to use jQuery-UI Dialog to show
I want to show a dialog which gets its content from server dynamically using
I have used jquery dialog i want it to close automatically after say 2
I want to show a popup screen on my page using JQuery UI Dialog
I want to show the current height and width of jQuery-UI dialog in real
I want to show a Dialog, I am using jquery ui with asp.net mvc
I've got a HTML link <a href=http://jquery.com>Click</a> I want to show a dialog box

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.