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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:23:54+00:00 2026-05-27T18:23:54+00:00

I have a JQuery Dialog, with a control inside containing textbox, I also have

  • 0

I have a JQuery Dialog, with a control inside containing textbox, I also have a ok button inside. On the ok click I get the value from the textbox and pass it to a function.

Problem:

Everytime I change the value in the textbox it only gets the old value,

so, if the original value is 3, i change it to 20, i click the button, it gets the value 3.

Anyone have any ideas as to why it does this?

thanks!

here is some code:

JQUERY:

$("#addtxt").click(function (e) {
  $("#dialog").show('slide');
  $("#dialog").html('<input id="my_txttext" name="my_txttext" title="Manoj" type="text" label="Add Text" />');
  $("#dialog").dialog({
      resizable: false,
      modal: true,
      position: {
          my: 'center',
          at: 'center',
          //    collision: 'fit',
          // ensure that the titlebar is never outside the document
          using: function (pos) {
              var topOffset = $(this).css(pos).offset().top;
              if (topOffset < 0) {
                  $(this).css('top', pos.top - topOffset);
              }
          }
      },
      width: 300,
      CloseText: '',
      title: 'Add Text',
      buttons: {
          'OK': function () {
              //to create dynamic div to contain data
              var div = document.createElement('div');
              $(div).attr("id", "dyndiv" + count);
              objid = "dyndiv" + count;
              count++;
              $('#sel_obj_text').val("Text");
              text_visibility();

              var $ctrl = $(div).text($('#my_txttext').get(0).value).addClass("draggable ui-widget-content HandleTopRowBorder").draggable({
                  containment: '#containment-wrapper',
                  cursor: 'move',
                  snap: '#containment-wrapper'
              });

              $("#containment-wrapper").append($ctrl);
              $('#' + objid).position({
                  of: $("#containment-wrapper"),
                  my: "center" + " " + "center",
                  at: "center" + " " + "center"
              });
              //    $('#my_txttext').val('')
              $(this).dialog("destroy");

          },
          'Cancel': function () {
              $(this).dialog("destroy");
              // I'm sorry, I changed my mind                 
          }
      }

  });
  • 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-27T18:23:55+00:00Added an answer on May 27, 2026 at 6:23 pm
    $("#addtxt").click(function (e) {
      var $input = $('<input title="Manoj" type="text" placeholder="Add Text" />');
      $("#dialog")
        .empty()
        .append($input)
        .show('slide')
        .dialog({
          resizable: false,
          modal: true,
          position: {
              my: 'center',
              at: 'center',
              //    collision: 'fit',
              // ensure that the titlebar is never outside the document
              using: function (pos) {
                  var topOffset = $(this).css(pos).offset().top;
                  if (topOffset < 0) {
                      $(this).css('top', pos.top - topOffset);
                  }
              }
          },
          width: 300,
          CloseText: '',
          title: 'Add Text',
          buttons: {
              'OK': function () {
    
                  $('#sel_obj_text').val("Text");
                  text_visibility();
    
                  $("<div>", { 'id' : "dyndiv" + count })
                    .text($input.val())
                    .addClass("draggable ui-widget-content HandleTopRowBorder")
                    .draggable({
                      containment: '#containment-wrapper',
                      cursor: 'move',
                      snap: '#containment-wrapper'
                    })
                    .appendTo("#containment-wrapper")
                    .position({
                      of: $("#containment-wrapper"),
                      my: "center" + " " + "center",
                      at: "center" + " " + "center"
                    });
    
                  $(this).dialog("destroy");
    
                  count++;
              },
              'Cancel': function () {
                  $(this).dialog("destroy");
              }
          }
    
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JQuery Dialog, with a control inside containing textboxes, I also have
i have a fileupload control and a button inside a jquery dialog but the
I have a Jquery dialog with an ASP listview control inside. Before showing the
I have a jQuery UI Dialog working great on my ASP.NET page: jQuery(function() {
I have a modal dialog plugin written in jquery, that binds to the click
I am developing a user control and it has an asp.net button inside jQuery
I have an asp.net usercontrol that contains a jQuery UI Dialog Control. All works
Right now, I have a jQuery UI pop-up dialog that reads from an external
I have a jQuery UI Dialog that gets displayed when specific elements are clicked.
I have a problem with the jquery-ui dialog box . The problem is that

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.