Why do you need to test the existence of the parent container? The HTML you listed was:
<div id="parentContianer"> <div id="#childEle1"></div> <div id="#childEle2"></div> <div id="#childEle3"></div> <div id="#childEle4"></div> <div id="#childEle5"></div> <div id="#childEle6"></div> </div> If your code runs any time after block of HTML e.g. in a "ready" function or even in inline code after the HTML, both the parentContianer [sic] and all of its child elements have already been created. Just grab your references and run. -Mike > From: Micky Hulse > > Hmmm, also, I suppose I could do the below when setting-up my > variables: > > var $parentObj = $('#parentContianer'); > if($parentObj.length > 0) { > // $parentObj exists, cache child objects: > var $childObj1 = $('#childEle1'); > var $childObj2 = $('#childEle2'); > var $childObj3 = $('#childEle3'); > var $childObj4 = $('#childEle4'); > var $childObj5 = $('#childEle5'); > var $childObj6 = $('#childEle6'); > } > > Is that an acceptable or weird way to do it?