The example in this article describes how jQuery uses the load() method to load the content of a specified tag in another web page file into a div tag. Share it with everyone for your reference. The specific analysis is as follows:
jQuery loads the specified tag content in another web page file into the div tag through the load() method. If we can load the tag content with the id p1 in the web page b.html into the div tag of the web page a.html
<!DOCTYPE html> <html> <head> <script src="js/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").load("demo_test.txt #p1"); }); }); </script> </head> <body> <div id="div1"><h2>使用jQuery AJAX改变此处内容</h2></div> <button>改变外部内容</button> </body> </html>
I hope this article will be helpful to everyone’s jQuery programming.