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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:11:39+00:00 2026-05-14T02:11:39+00:00

I ran into a bit of trouble while trying to load an external HTML

  • 0

I ran into a bit of trouble while trying to load an external HTML page into a div using jQuery-ajax.
I had this div: <div id="content"></div>
and wanted to fill it with $("#content").load("include/add.html");
It loads the HTML file perfectly, but inside that add.html is a button that should load add2.html(also using .load), but it seems that neither the button nor the datepicker in that file work.
I’m guessing the .load function is responsible for that?

This is the content of add2.html:

<p>Nr: <input type="text"></input></p>
<p>Name: <input type="text"></input></p>
<p>Date: <input type="text" id="datepicker"></input></p>
<a href="#" id="button1">Next</a>

Please help, I’m desperate 😀

  • 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-14T02:11:40+00:00Added an answer on May 14, 2026 at 2:11 am

    As the file is included to the page after the events are bound, the events do not apply to the elements in ‘add.html’. You need to bind the events again or use .on() method. In the case of the datepicker, it’s easier to go with the first approach:

    $("#content").load("include/add.html", function() {
        // Apply datepicker to elements in 'add.html'
        $('#content .date').datepicker();
    });
    

    For the button in add.html, you can use delegation:

    $(document).on('click', '#content .button_in_add', function() {
        alert("I work even when included dynamically!");
        $('#content').load('include/add2.html');
    });
    

    Note that .on() bins does not go inside the .load() callback as the datepicker part did. If you have any elements in ‘add2.html’, you need to repeat the same steps for that also.

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

Sidebar

Related Questions

I've recently ran into a bit of a pain. I've been using the JQuery
Ran into a bit of trouble when trying to insert records into my DB
Hi :) I've ran into a bit of a trouble. (short-form: whenever the page
Ran into a bit of an issue with some jQuery code, but in essence,
I'm writing my own software rasterizer in Java, and I ran into some trouble
I have ran into a bit of problem. Originally, I have the following input
I'm writing a Fixedpoint class, but have ran into bit of a snag... The
Just ran into a bit of code that wasn't doing what I thought it
I've been writing simple JSON schemas but I ran into an API input call
I have a mapView with custom annotations and just ran into a problem on

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.