javascript - iframe doesn't getting hidden using JQuery -
in page have div div , iframe shown below.
<div class="v_dissc_tab" id="tabs-1"> <div id="publicevent"> <div class="crtraone" style="margin-left:800px;"> <button onclick="addpublic()">add new</button> </div> <div> <table width="100%"> <tr> <td><b>programme</b></td> <td><b>scheduled start time</b></td> <td><b>scheduled end time</b></td> <td><b>amount</b></td> <td><b>status</b></td> <td></td> </tr> <tr> <?php if($publicnum>0) { } else { ?> <td colspan=6> <?php echo "no public channel programmes";?> </td> <?php }?> </tr> </table> </div> </div> <iframe id="calendarframe" style="width: 100%;height:600px;display:none;" src="<?php echo base_url()?>index.php/channel/viewbookings"> </iframe> </div>
on page loading, div id publicevent
shown , iframe hidden. when click on add new button, iframe loaded. inside iframe loading page contains button
<button onclick="managepublic()">manage public events</button>
on clicking button, want show div id publicevent
, want hide iframe (as when page firstly loaded). shown below managepublic()
.
function managepublic() { location.reload(); // not making changes //$('#publicevent').show(); tried //$('#calendarframe').hide(); }
can me solve this. in advance.
try following code snippet.
you referring elements of <iframe>
's parent.
function managepublic(){ $('#calendarframe', window.parent.document).hide(250, function() { $('#publicevent', window.parent.document).show(); }); }
or
function managepublic(){ window.parent.$('#calendarframe').hide(250, function() { window.parent.$('#publicevent').show(); }); }
or change order of hide events.
function managepublic(){ window.parent.$('#publicevent').show(); window.parent.$('#calendarframe').hide(); }
note :
- for work, parent must have jquery included.
- it won't work if parent in different domain.
Comments
Post a Comment