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?