Hi I would like to load a page using iFrame on my website. and as a final result I need to hide everything and show just one div's inner text. How can I accomplish it using jQuery? or maybe another workaround
+2
A:
Assuming you have
Iframe contains div with id=”someID”:
Hello world!Use the following to access the HTML
$('#iframeID').contents().find('#someID').style('display:none;');
Joe Garrett
2010-07-07 15:25:43
+1
A:
it is not working for me here is my code
<head> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> </head> <body> Question Viewed: <div id="data"> <iframe src="http://www.name.com" id="test" name="test" width="600px" height="600px"></iframe> </div> <script type="text/javascript"> $(document).ready(function () { $('#test').contents().find('.content').style('display:none;'); }); </script>
Eugene
2010-07-07 15:48:37
Your .find('.content') seems to be referencing a class rather than an id. Are you sure you have that class defined??? either in css or otherwise..
Joe Garrett
2010-07-12 22:19:08
+1
A:
$("#test").contents().find("#content").setAttribute("style","display:none");
Sorry I believe this is better suited to what your looking to do.
Joe Garrett
2010-07-07 17:10:00