However, you cannot specify an element to import.
For example, based on the contents of the above page,
in Lab 6.html
Is it possible to load only 'div class="panel-body"
I tried using .load in jquery, but since all the sources in html are loaded,
I can't even consider how to deal with it.
It would be very helpful if someone could let me know.
Thank you for your cooperation.
If Lab6.html contains the following:
<html>
<body>
<h1>test</h1>
<div class="panel-body">this and that</div>
<div>hoge</div>
</body>
</html>
This is an example of jquery extraction of div class="panel-body".
(This is an example of when div class="panel-body" is only one, if there are more than one, use .eq() to take it out.)
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$.get("lab6.html", function(data){
varjq_obj=$($.parseHTML(data)));
$("#data").append(jq_obj.filter("div.panel-body"));
});
});
</script>
</head>
<body id="data">
</body>
</html>
© 2024 OneMinuteCode. All rights reserved.