jquery call the iframe document ready after parent load completed -
in parent window there few tabs shown. on parent window think there code of click unable access or view parent page.
$(document).ready(function(){ $('.tab').click(function(){ // something. show/hide tab panel according tabs }); })
on frame window
$(document).ready(function(){ // add new tab in parent window frame. $("#parenttab", parent.document).after('<a href="#" class=".tab" tabid="newtab">new tab</a>'); // add panel in parent window new tab $("#parenttabpanel", parent.document).after('<div tabid="newtab">some content</div>'); })
this code works fine , not showing js error. iframe content load , added tabs on parent window. when click on newtab doesn't show tabpanel. strange when ctrl+refresh browser works.
i not work when first time load why? please me solve issue. copy parent tab click event new added tab. possible? how check.
your new tabs added dynamically , not have event handlers set.
you can register handler on document object instead:
$(document).ready(function(){ $(document).on('click', '.tab' ,function(){ // something. show/hide tab panel according tabs }); })
it possible children's 'ready' event fires after parent window's 'ready' event. making first page load not working.
Comments
Post a Comment