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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:57:49+00:00 2026-06-16T01:57:49+00:00

I have a pop up from where the value is selected. When I select

  • 0

I have a pop up from where the value is selected. When I select the value the control goes to server via ajax call and in callback method I have the HTML page generated.

I’ve tried to set the value to div like this to a div.

$("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());

When I use the above line, the value is getting set to the div for the first time but after that, whenever I select a new value and the ajax call happens, the value is not getting set and the whatever I had set for the first time remains.

UPDATE:

The ajax method I use to set the values:

function getCustomerDetails(customerName,viewName) {
    var global = window.document

        $.ajax({
             type: "POST",
            url: viewName,
            data: {
                id: customerName
            },
            success: function (msg) {


                global.getElementById("CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").innerHTML = $('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html();

                alert($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());
                alert($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod', msg).html());

                $("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());
                $("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod', msg).html());

            }
        });

}

How do I update the new value to the div?

  • 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-16T01:57:50+00:00Added an answer on June 16, 2026 at 1:57 am

    Judging from the fact that your AJAX works the first time but not after .replaceWith() it’s probably because all event handlers are removed when you replace a node with a piece of HTML fragment.

    You should register your event handlers using .on() or .delegate() on nodes that will not get removed throughout the lifetime of your app.

    Let’s assume you have this structure:

    <div id="mybase">
       <div class="mysel">
           <select name="test"><option /> ... </select>
       </div>
    </div>
    

    And assume you register event handlers like this:

    $('#mybase input[name="test"]').change(function() {
        // replace $('#mybase .mysel') with something that has the same dropdown
    });
    

    Now your event handler would be gone and any changes in the dropdown are not firing your event handler.

    Instead you could do this:

    $('#mybase').on('change', 'input[name="test"]', function() {
        // replace $('#mybase .mysel') with something that has the same dropdown
    });
    

    Hope that helps.

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

Sidebar

Related Questions

I currently have an Ajax pop up window displayed from the main page of
I have a select element from which the users can select a value and
I have a asp.net usercontrol (.ascx). the user control has a HTML hidden field.
I have a pop up date picker which insert a selected date into a
How can i pass value from grid view to a pop up in client
I have a method which I am calling from onCreate( main thread). Inside the
I have changed this.value = terms.join( ; ) line from comma (,) to (;)
I have pop-up with h:selectOneMenu . This pop-up will be displayed on a4j:commandLink click.
I've been trying to use 'import poplib' to access gmail, since I have Pop
I have a pop-up window in jQuery that fades in, and will fade out

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.