-3

I have a single page website which includes an iframe in it, when iframe load it contains a table which I want to hide and this table also repeats on multiple pages so I want to add a code in my main page header which finds this content from iframe and hide it if even iframes loads new pages the code which I want to hide is

<table cellSpacing="0" cellPadding="0" border="0">
<tr>
<td width="225"><a id="_ctl0_ucMNB_logo_LogoHyperLink" href="#"><img id="_ctl0_ucMNB_logo_imgLeftPart" class="header_logo_img" src="#" border="0" /></a></td>
</tr>
</table>
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Refer this post: http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe? rq=1 – K K Apr 28 '14 at 09:51
  • 1
    Is the iFrame src in the same domain as the main page? – OJay Apr 28 '14 at 09:51
  • You should urgently improve your question to make it clearer... – A. Wolff Apr 28 '14 at 09:54
  • If you give the table a specific id, you can select the content of the iframe like the answer below and then select the table from it and delete it: `.contents().$('#idyougavetothetable').remove()` – MarijnS95 Apr 28 '14 at 09:59

2 Answers2

0

You can use .contents() to get the content of the iframe and do the operation on it, For more details https://api.jquery.com/contents/

jQuery, select element inside iframe, which is inside an iframe

Community
  • 1
  • 1
RONE
  • 5,415
  • 9
  • 42
  • 71
  • `` even after the iframe loads the new page clicking on link this code not work please help – HassanZobeen Apr 28 '14 at 11:05
  • @user1393638, can you make a fiddle in http://jsfiddle.net/ of your code, will look – RONE Apr 28 '14 at 11:12
  • here is the fiddle which i have http://jsfiddle.net/C9Ly4/ when we click on some link present in iframe it loads new pages, which contains div #_ctl0_ucMNB_logo_LogoHyperLink and #_ctl0_bodyTag which i want to remove but this code done remove these tags please help me in this – HassanZobeen Apr 28 '14 at 12:23
0

$('iframe').contents().find('control');

abc
  • 157
  • 3
  • 14