Run jQuery ready block again after ajax loaded?

I'm not sure if I'm asking the right question here, but basically I'm inserting html with an ajax request:

// data-active_chart if ($("#charts").attr("data-active_chart") == "barchart") { $.ajax({ url: $("#charts").attr("data-path") + "/barchart", success: function(data) { $('#charts').html(data); console.log('Load was performed.'); } }); }

And my HTML is something like:

<div id="charts" data-active_chart="barchart" data-path="http://example.com/something"> </div>

But the point is I need jQuery to be aware of the updated DOM, like I need my tool tips and such to work in the HTML that's been inserted, along with a bunch of other things in the inserted HTML all need to respond to JS, how do I do this in a best practices way?


If you need to bind events that will occur after the DOM has changed use jQuery live!


If the existing handlers were attached using jQuery live, you should be good to go after updating the DOM.

You will have to test that this is the case though; it could be that certain libraries you are using may have been using .click() or .hover() directly in which case you will need to reinitialize the handlers or libraries after updating the dom.


  • Adding Extra Data to Auth Cookie after login - MVC 5
  • is uninitialized_copy/fill(In first, In last, For dest, A &a) an oversight in the c++ standard?
  • Is there any point in using DI for class injections
  • How are 32 bit JavaScript numbers resulting from a bit-wise operation converted back to 64 bit numbe
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Loading .coffee files via a view in Rails
  • Detect when Facebook like button is clicked
  • Create DicomImage from scratch using Dcmtk
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Get data from AJAX - How to
  • Android screen density dpi vs ppi
  • Bug in WPF DataGrid
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • Perl system calls when running as another user using sudo
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • jQuery tmpl and DataLink beta
  • How to pass list parameters for each object using Spring MVC?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to get icons for entities from eclipse?
  • How to disable jQuery.jplayer autoplay?
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • need help with bizarre java.net.HttpURLConnection behavior
  • JaxB to read class hierarchy
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?