I have checkboxes which I want to check and uncheck by using button

for example suppose I want check checkbox 0 to 9 should be checked then I click on "10 or less" button so other checkbox must uncheck and only that check box checked which index less has than 10

**Button**

```
<button class="1-10">10 or less</button>
<button class="1-25">25 or less</button>
<button class="1-50">50 or less</button>

```

**Checkbox**

```
<input type="checkbox" name="age[]" class="age_opts" value="1" /> 1 <br />
<input type="checkbox" name="age[]" class="age_opts" value="2" /> 2 <br />
<input type="checkbox" name="age[]" class="age_opts" value="3" /> 3 <br />
          ...
          ...
<input type="checkbox" name="age[]" class="age_opts" value="49" /> 49<br />
<input type="checkbox" name="age[]" class="age_opts" value="50" /> 50<br />

```

I have used loop for this but may be there is any better way please let me know.

Thanks in advance