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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:38:12+00:00 2026-05-21T16:38:12+00:00

There is one div which changes frequently it’s innerHTML by ajax. Once the page

  • 0

There is one div which changes frequently it’s innerHTML by ajax. Once the page loads, jQuery function() works but when innerHTML changes by ajax then some functionality doesn’t work. I checked the code using firebug and try to explain it in short.**

I think DOM loads the js file only when the page loaded first time and if ajax modifies innerHTML then function is not invoked somehow.What you say? what could be solution according to you?
HTML page

 <body>
     <div class="_div_change"> dynamically class add by jQuery function()

        here contenet is added by ajax functionality
     </div>

     <script type="text/javascript"> 
          $(function(){
            $('._div_change').addClass('.div_class');
                 });
     </script>
    </body> 

Loading first time & class is added by fn() |only div innerHTML modified by ajax *** 
                                            |  
    <div class="_div_change div_class">     | <div class="_div_change">
       innerHTML elements added successfully|   innerHTML elements altered successfully
    </div>                                  | </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-05-21T16:38:13+00:00Added an answer on May 21, 2026 at 4:38 pm

    Your script is incomplete, but assuming that it looks like this:

    $(function(){
            $('._div_change').addClass('.div_class');
    });
    

    …then what you’re doing there is telling jQuery to run that function once when the DOM is initially loaded (calling $() with a function is a shortcut to jQuery.ready). If you want to re-run that function when you update the div‘s contents via ajax, you’ll have to do that in your success handler on the ajax call.

    You can give jQuery a function that it will call whenever any ajax call is complete, via jQuery.ajaxSuccess, which may be useful.

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

Sidebar

Related Questions

I am creating a complete ajax application where there is one base page and
Is there a way to overlay/overlap two or more images using one div only?
There is div named dvUsers. there is an anchor tag lnkUsers. When one clicks
The code below throws an exception in firefox: $(function(){ $([one,two,three]).each(function(){ if(this == one) $(div#msg).html(this);
I have a div in which I frequently create child divs and later remove
There is a div (form) which opens on the click of a button. There
Sample page On the sample page I have set div#content { padding-bottom:20px; } which
I have a very simple YUI3 script which changes background of a web page.
What I am doing is creating a simple html page in which there is
i have one website which is working on templates. in the template there is

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.