Try this:
function jqCheckAll2(id,name) {
$("input[name='" + name + "']").each(function() {
$(this).attr("checked",true);
})
}
Hope this helps
Steve
On Fri, Apr 15, 2011 at 12:20 PM, Greg Morphis <[email protected]> wrote:
>
> I have a page with a bunch of groups of checkboxes.
> I'm trying to add functionality so the user can do a "check all" and
> it would in turn check all the boxes.
>
> I found this via a google search but it's selecting EVERY checkbox on
> the page, not just the ones names "state_abbr".
> function jqCheckAll2( id, name )
> {
> $("INPUT[@name=" + name + "][type='checkbox']").attr('checked',
> $('#' + id).is(':checked'));
> }
> </script>
>
>
> and...
> <input type="checkbox" name="checkAllStates" id="checkAllStates"
> onclick="jqCheckAll2( this.id, 'state_abbr' )"/> Check All States
>
> The other groups and correctly names com_id, workgroup_id, etc.. so
> why is jQuery checking them?
>
> Thanks!
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343754
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm