jQuery USES the load of method to load the specified tag content in another web file into the div tag method

  • 2020-05-19 04:06:20
  • OfStack

The example in this article shows how jQuery USES the load() method to load the specified tag content in another web file into the div tag. Share with you for your reference. The specific analysis is as follows:

jQuery loads the content of the specified tag from another web file into the div tag via the load() method, if we can load the content of the p1 tag from b.html into the div tag from 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> use jQuery AJAX Change the content here </h2></div>
<button> Changing external content </button>
</body>
</html>

I hope this article is helpful for you to design jQuery program.


Related articles: