[jQuery] Re: check/uncheck all checkboxes with specific id

2009-07-01 Thread Cesar Sanz
egroups.com Sent: Tuesday, June 30, 2009 1:34 PM Subject: [jQuery] Re: check/uncheck all checkboxes with specific id definitely defer to experience. Question, have seen you mention attr() is broken,don't use it. I try to learn and absorb as much as possible from here Is it the pe

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread Charlie
definitely defer to experience. Question, have seen you mention attr() is broken,don't use it. I try to learn and absorb as much as possible from here Is it the performance of attr() or reliablity problem? Matt Kruse wrote: On Jun 30, 12:24 pm, "evanbu...@gmail.com" wrote:    

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread Matt Kruse
On Jun 30, 12:24 pm, "evanbu...@gmail.com" wrote: >                 $(':checkbox.chkEvent').each(function() { >                     var el = $(this); >                     el.attr('checked', el.is(':checked') ? '' : > 'checked'); >                   }) Avoid attr(), and try to avoid fitting ever

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread Charlie
going back to the OP there is an easy method to get "starts with", and it is not necessary use each() or if  to check them $("input[id^='chkEvent']").attr("checked","checked"); this will check *all * starting with ID = chkEvent evanbu...@gmail.com wrote: Thanks. I still don't have somet

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread evanbu...@gmail.com
Thanks. I still don't have something quite right because this isn't working. I've added the class property to each of my event checkboxes. //check all checkbox just for the events $(document).ready(function() { $('#toggleEvents').click( function() {

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread aquaone
As previously stated classes would be better. Also of note, @ in attribute selectors is deprecated, but better yet, input:checkbox (which is faster than simply :checkbox I've been told). Also, if you insist on doing ids instead of class, it'd be better to use the "starts with

[jQuery] Re: check/uncheck all checkboxes with specific id

2009-06-30 Thread Eric Garside
Is there a particular reason you couldn't use classes to do this? Instead of the markup you provided, something like: Then: // Use the :checkbox instead of the old method you're using $(':checkbox.chkEvent').each(funciton(){ var el = $(this); el.attr('checked', el.is(':checked') ? ''