Home >Web Front-end >JS Tutorial >jQuery uses the load() method to load the specified tag content in another web page file into the div tag_jquery

jQuery uses the load() method to load the specified tag content in another web page file into the div tag_jquery

WBOY
WBOYOriginal
2016-05-16 16:07:411512browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn