Reputation: 2162
so i have this HTML for example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>how are you</div>
<p>whatttt</p>
<div id="main">
<div id="test">
div content
<br>
<table class="table">
<thead> </thead>
<tr>
<th>
some header
</th>
</tr>
<tr>
<td> cell </td>
</tr>
</table>
</div>
</div>
</body>
</html>
so if i want to load this with i frame but load only the div class="main"
it will be like this:
<iframe class="test" src="testing.html" onload="$('body>*',this.contentWindow.document).not('#main').hide();"></iframe>
what if i want to show only for example : the div id="test"
or the table class="table"
that are in the din class="main"
how can i go deeper to those divs in that main div?
Thanks in advance guys!
Upvotes: 0
Views: 3267
Reputation: 9528
I don't think you can modify the content inside an iframe. You can try loading it into a div instead.
$('.test').load('testing.html #main');
Replace
<iframe class="test"> with <div class="test">
Upvotes: 0
Reputation: 148180
Try this,
For div with id = test within div id = main
this.contentWindow.document).not('#main #test').hide();
<iframe class="test" src="testing.html" onload="$('body>*',this.contentWindow.document).not('#main #test').hide();"></iframe>
For div with class = table within div id = main
this.contentWindow.document).not('#main .table').hide();
<iframe class="test" src="testing.html" onload="$('body>*',this.contentWindow.document).not('#main .table').hide();"></iframe>
Upvotes: 1