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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:39:42+00:00 2026-06-13T12:39:42+00:00

I have a div: <div id=dialog></div> And there’s a javascript function that brings up

  • 0

I have a div:

<div id="dialog"></div>

And there’s a javascript function that brings up a JQueryUI dialog:

ui_info(title,txt)
{
     $('#dialog').attr('title', title).text(txt).dialog({
    width: 500,
    buttons:
[{
    text: 'OK',
    click: function ()
    {
        $(this).dialog('close');
    }
}
],
});
return false;
}

My problem is if I call this method once I get title and the text right. But if I call it again the text changes , however the title for the dialog remains the same. So for instance, if I call this function like this:

ui_info('First title','This is the first text');

I get the title ‘This is title 1’ and the text ‘This is the first text’. And then if I call it again like this:

ui_info('Next title','The text is different now');

For text I’ll get ‘The text is different now’, which is what I want, but for the title I still get ‘First title’, whereas I’m expecting ‘Next title’

  • 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-13T12:39:43+00:00Added an answer on June 13, 2026 at 12:39 pm

    Use $(this).dialog('destroy'); instead of $(this).dialog('close');

    Demo of your version: http://jsfiddle.net/wCWTE/1/

    Demo of corrected version: http://jsfiddle.net/wCWTE/

    If you still want to use the close method you can use the open event and setting the title using the option given by default by the dialog settings, so you will have:

    function ui_info(title,txt)
    {
      $('#dialog').text(txt).dialog({
        width: 500,
        buttons:
        [{
           text: 'OK',
           click: function ()
           {
              $(this).dialog('close');
           }
        }],
        open:function() {
            $(this).dialog('option','title',title)
        }
      });
    }
    

    Please see this new demo http://jsfiddle.net/wCWTE/2/

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

Sidebar

Related Questions

I have dialog created like this $('#add_error').click(function(e) { $('<div>') .load('/someaction/format/html/') .dialog({ title: 'Some title',
I have a div containing a form. I use that div as a dialog
Well i have a div tag that i show as a modal dialog this
I have a dialog with just the one text box inside. <div id=commonDialog style=width:
I have a dialog box designed like this: <div id=choose_product title=Choose a Product style=display:none;>
There is a div: <div id=question>ddddd</div> I have written a code that hide the
I have a div that is being used as a dialog with jQuery's .dialog()
I have a div that I'm setting a title attribute on: <div id=test title=Test
I have a dialog - <div data-role=dialog id=msg-popup> <div data-role=header> <h1>Notification</h1> </div> <div data-role=content
I have a jquery dialog as follows - <div data-role=dialog id=msg-popup> <div data-role=header> <h1>Notification</h1>

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.