Why not use input type="radio" instead of checkboxes? That would allow you to restrict users to a single choice without any javascript.
Also, "name" is not a valid attribute for a <div>, giving it an ID will make your query way faster. Event delegation can help too: $('#limit1').click(function(e){ var tgt = e.target||e.srcElement; $(this).children(':checkbox').not(tgt).removeAttr('checked'); }); - ricardo On Nov 3, 11:24 pm, Cheng S.Kai <[EMAIL PROTECTED]> wrote: > Thanks.! will try that > > Regards, > Kai > > > > > Date: Sat, 1 Nov 2008 18:07:18 +1100 > > From: [EMAIL PROTECTED] > > To: jquery-en@googlegroups.com > > Subject: [jQuery] Re: Unresponsive script when navigating away > > > Oh and ":checkbox" is a "shortcut" for "input[type=checkbox]". > > > Karl Rudd > > > On Sat, Nov 1, 2008 at 6:05 PM, Karl Rudd <[EMAIL PROTECTED]> wrote: > > > Instead of doing the search each time, cache the selected objects. > > > > <script type="text/javascript"> > > > $(document).ready(function (){ > > > var checkboxes = $('div[name=limit1] label > > > input[type=checkbox]'); > > > checkboxes.bind('click',function(){ > > > checkboxes.each(function(){ > > > this.checked = ""; > > > }); > > > this.checked = "checked"; > > > }); > > > }); > > > </script> > > > > Karl Rudd > > > > On Thu, Oct 30, 2008 at 2:59 PM, bugpanye <[EMAIL PROTECTED]> wrote: > > > >> <script type="text/javascript"> > > >> $(document).ready(function (){ > > >> $('div[name=limit1] label > > >> input[type=checkbox]').bind('click',function(){ > > >> $('div[name=limit1] label > > >> input[type=checkbox]:checked').each(function(){ > > >> this.checked = ""; > > >> }); > > >> this.checked = "checked"; > > >> }); > > >> }); > > >> </script> > > > >> hi all, > > > >> the code above i use to make a list of checkbox limited to one selection > > >> at > > >> a time, my trouble is that now i have over 100+ checkboxes, the script > > >> becomes extremely sluggish and gives me the Unresponsive script warning > > >> when > > >> i reload the page.. > > > >> is there anyway to speed up this script?:super: > > > >> ----- > > >> bugpanye-backpacks > > >>http://www.e-packs.comhealthy backpacks for all > > >> -- > > >> View this message in > > >> context:http://www.nabble.com/Unresponsive-script-when-navigating-away-tp2024... > > >> Sent from the jQuery General Discussion mailing list archive at > > >> Nabble.com. > > _________________________________________________________________ > Manage multiple email accounts with Windows Live Mail > effortlessly.http://www.get.live.com/wl/all