Select All Checkboxes By ID/Class

javascript

Solution

Using JQuery, you can do this very easilly!

$(".ClassName").attr("checked", "true");

or a single ID

$("#ID").attr("checked", "true");

See: Check All Checkboxes with JQuery.

Problem

I'm really bad at Javascript and I'm struggling to get my head round it. What I'm trying to do is get something to select all checkboxes. However everything I have found tries to do it by name, I want to do it by ID or class. Select all by name is just inpractical isn't it?

Original source

Related problems