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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:45:08+00:00 2026-05-15T03:45:08+00:00

I hope you can help me with this. I’ve been using jquery datepicker in

  • 0

I hope you can help me with this. I’ve been using jquery datepicker in a modal dialog. After some problems at the beggining (given by the z-index) it works just fine. The thing is that I have in my page content that keeps on being modified via .innerHTML property of the divs. For this case, I’m loading the content of the modal box via a partial view like this:

<div id = "newNotificationModalBox">
                <% Html.RenderAction("CreateNotification", "Notification"); %>
</div>

I’ve got an Add button that doesn’t submit my form, because I’m not interested in leaving the page, it just call via ajax to make the changes to the database, and displays a table with the data inserted on the right. This will allow the user to keep on inserting rows in the database till he finally decides to submit the changes, so the rows will be inserted. Till now it works just fine, I open de dialog box and date picker works perfectly.

The problem comes only in this case scenario. Whenever the user clicks in the Add button, and any of the fields has not been filled properly, I take the response from the ajax call in order to show the errors:

var view = $.ajax({
            type: "POST",
            url: "/Suspension/CreateTemporalSuspension1SF1C",
            data: dataString,
            async: false

        });
///
///Checks if the input has been valid, if not it will go to this point
///
        document.body.innerHTML = view.responseText;

        $("#Calendar").datepicker('destroy');
        var dateoptions = { dateFormat: 'dd/mm/yy' };
        $("#Calendar").datepicker(dateoptions);

But the calendar doesn’t work anymore. Any clue on why does it happens this way? I know the problem is when I reload the page content via modifying the innerHTML, do you know any kind of patch around this?

  • 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-15T03:45:09+00:00Added an answer on May 15, 2026 at 3:45 am

    Have you tried:

    $(document.body).html(view.responseText);
    

    Instead of: document.body.innerHTML = view.responseText;

    Also, you should destroy the datepicker before you replace it with the response.

    So something like:

    var view = $.ajax({
                type: "POST",
                url: "/Suspension/CreateTemporalSuspension1SF1C",
                data: dataString,
                async: false
    
            });
    ///
    ///Checks if the input has been valid, if not it will go to this point
    ///
            $("#Calendar").datepicker('destroy');
            $(document.body).html(view.responseText);
    
            var dateoptions = { dateFormat: 'dd/mm/yy' };
            $("#Calendar").datepicker(dateoptions);
    

    I do agree with Khnie that you should definitely use a div specifically for validation errors and messages instead of replacing the whole body‘s contents.

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

Sidebar

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.