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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:30:45+00:00 2026-05-22T02:30:45+00:00

I would like to toggle the JQuery Dialog using a button. To replace the

  • 0

I would like to toggle the JQuery Dialog using a button.

To replace the text in the dialog I use .replaceWith()

The problem is, that the text isn’t replaced, and the dialog shows up, even when I have set

<div id="dialog-confirm" title="Can you confirm?" style="display: none;"> 

Here is the code

(function() {
    $( "#dialog:ui-dialog" ).dialog( "destroy" );

    $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
            "Okay": function() {
                $( this ).dialog( "close" );
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        }
    });
});

function showhide(iname) {
    var item = document.getElementById(iname).style;
    if (item.display == 'none') {
    item.display = '';
    } else {
    item.display = 'none';
    }
}

$('div.dialog-text').replaceWith( "<b>New text goes here</b>" );

and can be tried out live at

http://jsfiddle.net/littlesandra88/XxVtU/

Also, if there is a better way, please let me know =)

  • 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-22T02:30:46+00:00Added an answer on May 22, 2026 at 2:30 am

    If you (for some reason) want to use replace the text using .replaceWith() method, you should make use of the callbacks (in this case the “create” or “open” callback”) that are available in jQueryUI.

    I’ve added an updated version of your own code doing what I thought you were trying to do.

    http://jsfiddle.net/XxVtU/7/

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

Sidebar

Related Questions

I have some simple jQuery toggle script like this: <script type=text/javascript> $(document).ready(function() { $('#clickedit').click(function()
I am using jQuery Tools validator and I would like to add a simple
I have a bunch of urls that toggle user settings I would like to
I'm looking for a roller toggle in jquery (ideally using a plugin). If I
I would like to use an a tag to trigger appending hidden li items
Hi again :) I'm using jQuery script to show/hide some content: <script type=text/javascript> $('.toggleButton').click(function()
I am working with jQuery UI Accordion and it works great, but I would
I have a list of Child objects. I would like to be able to
With jquery I am adding a div and appending the text click to view
I have a 3 div's, the jQuery script adds a class when a div

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.