javascript - How to check 0 to nth index checkbox in using jquery -
i have checkboxes want check , uncheck using button
for example suppose want check checkbox 0 9 should checked click on "10 or less" button other checkbox must uncheck , check box checked index less has 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 may there better way please let me know.
thanks in advance
you'll want use .slice(n, n+1) slice out checkboxes want. please see following question shares lot of similarity yours:
Comments
Post a Comment