Targeting an iFrame once with jQuery

Posted by user275074 on Stack Overflow See other posts from Stack Overflow or by user275074
Published on 2010-03-19T14:49:15Z Indexed on 2010/03/19 14:51 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

Hi,

I have a series of frames (4) which are used in a page to create loading of dynamic content through Ajax calls.

In each of these frames I target parent level elements and update them with there respective content e.g.

$("#loadingGrid1",top.document).show(); $("#frameSkills",top.document).hide();

In jQuery is there a way to instead of targeting specific elements on the parent page multiple times, simply target the page once into a variable e.g. var parentPage=$('#frameSkills',top.document);

And then use this variable to apply content like $(parentPage > #loadingGrid1).hide()

Hope I've explained what I'm after enough. Basically, I'm having to call "top.document" in every jQuery selector I make and it seems like a waste of energy.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about selector