[jQuery] Effiecint way to create an object for checkboxes onload
Hi I've multiple criteria of checkboxes on one page. Each criteria contains
differnt number of checkboxes. I've 8 criterias of checkboxes.
For example
<div class="refSearchCuisineForm">
<div><input type="checkbox" >A</div>
<div><input type="checkbox" >B</div>
<div><input type="checkbox" >C</div>
</div>
<div class="refSearchEntreeForm">
<div><input type="checkbox" >A1</div>
<div><input type="checkbox" >B1</div>
<div><input type="checkbox" >C1</div>
<div><input type="checkbox" >D1</div>
<div><input type="checkbox" >E1</div>
</div>
etc...
All I'm trying to do is create objects for each criteria of checkboxes like
mentioned below on page load
var $cuisineCheckBoxObject = $(".refSearchCuisineForm
input[@type='checkbox']");
cuisineCheckBoxObject=$cuisineCheckBoxObject[0];
var $entreeCheckBoxObject = $(".refSearchEntreeForm
input[@type='checkbox']");
entreeCheckBoxObject=$entreeCheckBoxObject[0];
var $neighborhoodCheckBoxObject = $(".refSearchNeighborhoodForm
input[@type='checkbox']");
neighborhoodCheckBoxObject=$neighborhoodCheckBoxObject[0];
var $openForCheckBoxObject = $(".refSearchOpenForForm
input[@type='checkbox']");
openForCheckBoxObject=$openForCheckBoxObject[0];
var $restTypeCheckBoxObject = $(".refSearchRestTypeForm
input[@type='checkbox']");
restTypeCheckBoxObject=$restTypeCheckBoxObject[0];
var $restFeaturesCheckBoxObject = $(".refSearchRestFeaturesForm
input[@type='checkbox']");
restFeaturesCheckBoxObject=$restFeaturesCheckBoxObject[0];
var $barTypeCheckBoxObject = $(".refSearchBarTypeForm
input[@type='checkbox']");
barTypeCheckBoxObject=$barTypeCheckBoxObject[0];
var $barFeaturesCheckBoxObject = $(".refSearchBarFeaturesForm
input[@type='checkbox']");
barFeaturesCheckBoxObject=$barFeaturesCheckBoxObject[0];
Annoyingly this initialition is taking 4-5 secs... I think I'm not doing is
in efficient way..I want to take this initialization to below 1 sec.. Is
that possible.. Please reply to this ASAP..
Thanks in advance.
Regards,
Vijay Potluri
--
View this message in context: http://www.nabble.com/Effiecint-way-to-create-an-object-for-checkboxes-onload-tf4483982s15494.html#a12786808
Sent from the JQuery mailing list archive at Nabble.com.