I have a very simple code. I like to hide some DIV's in my IFRAMe. So my index.html page looks like this, so the whole idea is hide the top and the leftpanel of from the Calendar.aspx page.
any idea what's wrong with my code or how should I do this?
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></<script>
<script type="text/javascript">
$( document ).ready(function() {
$("#leftpanel").hide();
$("#toppanel").hide
});
();
</script>
<iframe height="800px" width="800px" src="https://domain/Calendar/Calendar%20Color%20Overview.aspx" >
</iframe>
I achieved this by creating a hidden form that posts data to the iframe src then deletes itself onpageload. Left with a iframe with src(unknown).
I used post to send data to url. Need full control of target domain to receive request. Have not tried code with a GET request.
You can try this:
Or:
This method is not possible if you want to work with different domains.
The
document
focuses on the current document and not the<iframe>
. You need to go through itscontent
s and find the elements before hiding them.