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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:37:43+00:00 2026-06-04T06:37:43+00:00

I have a case where I need to update the title of a jQuery

  • 0

I have a case where I need to update the title of a jQuery UI
dialog with a Part number whenever a table cell is double clicked.
The title would be obtained from the table cell’s value itself.

This snippet (below) from the actual code works, but it just doesn’t
seem correct to me since I have to call the dialog function twice: (1)
to change the title, and (2) open the dialog.

Is there a better way to combine both operations with a single call to
.dialog()?

JS Snippet

// Dialog declaration
var my_dlg = $('<div id="my-dlg">')
  .html(
    '<span class="part">FOO BAR</span>'
  )
  .dialog({
    autoOpen: false,
    title: 'Default Title',
    modal: true
  });

// Event handler
$('td.part').live('dblclick', function(){
  $(my_dlg)
    .dialog('option','title', $(this).text())
    .dialog('open');
});

HTML Snippet

<table>
<tr><td class="part">AB123456</td></tr>
<tr><td class="part">GX443459</td></tr>
<tr><td class="part">SK555455</td></tr>
</table>
  • 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-04T06:37:44+00:00Added an answer on June 4, 2026 at 6:37 am

    This is the correct/only way of doing it as you have 2 events, the dialog opening itself, and the clicking of the table cell. That is also the correct way to alter any option in the jQuery UI dialog after you have instantiated it.

    The only unnecessary thing you have done is stuck my_dlg in $() the second time you use it, which it doesn’t need to be as it’s already a jQuery object.

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

Sidebar

Related Questions

I have a case where I need to update a jqgrid based on some
I have a case where I need to update a gui component based on
I have a case where I need to check if jQuery exists on a
I have a case where I need to select a random item, but I
I have a case where I need to load bitmap from a resource dll
I have a use case where I need to call a (non-static) method in
I have a very specific case that I need to debug. I need to
I have a use case where I only need to store certain fields to
I have a complicated problem, and I need help. I have a base case,
I have a strong use case for pre-allocating all the memory I need upfront

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.