lalabored Posted June 15, 2007 Share Posted June 15, 2007 I need a check all button that will work with this... <input type="checkbox" name="check[]" value="1"> All the check all scripts I've found only work with name="check" and it doesn't have the brackets. I need to check all of the fields with the brackets, how can I do this? Link to comment https://forums.phpfreaks.com/topic/55677-solved-check-all-button/ Share on other sites More sharing options...
lighton Posted June 15, 2007 Share Posted June 15, 2007 this is the javascript you will need function selectAll() { var box = document.getElementsByName('id[]'); if(box) { var boxes = box.length; for(var i = 0; i < boxes; i++) { if(box.checked) { box.checked = false; } else {box.checked = true;} } } } Link to comment https://forums.phpfreaks.com/topic/55677-solved-check-all-button/#findComment-275205 Share on other sites More sharing options...
jimmyyami Posted June 15, 2007 Share Posted June 15, 2007 this is also what i wanted Link to comment https://forums.phpfreaks.com/topic/55677-solved-check-all-button/#findComment-275344 Share on other sites More sharing options...
lalabored Posted June 16, 2007 Author Share Posted June 16, 2007 this is the javascript you will need function selectAll() { var box = document.getElementsByName('id[]'); if(box) { var boxes = box.length; for(var i = 0; i < boxes; i++) { if(box.checked) { box.checked = false; } else {box.checked = true;} } } } It doesn't work =\ Link to comment https://forums.phpfreaks.com/topic/55677-solved-check-all-button/#findComment-275623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.