jQuery replace all HTML
问题 I'm trying to replace all the HTML (including the HTML tags) with another page. What I'm trying to do is having a website acting as an app even when navigating the another page. Here is the code : (function($) { Drupal.behaviors.loadingPage = { attach: function(context,settings) { $('a').click(function(event) { event.preventDefault(); // Create the loading icon // ... $.ajax({ url: $(this).attr('href'), success: function(data) { $('html').replaceWith(data); } }); }); } }; })(jQuery); I've