pass it the form id and true/false and this should do it:
function toggleCheck (form_id, checked) { var form = $(form_id); for (var i = 0; i < form.elements.length; i++) { form.elements[i].checked = checked;
}
}
pass it the form id and true/false and this should do it:
function toggleCheck (form_id, checked) { var form = $(form_id); for (var i = 0; i < form.elements.length; i++) { form.elements[i].checked = checked;
}
}
This should select and check all the inputs in the element with id '#container' to uncheck them, just change the checked to false
<%=link_to_function "Select All", update_page {|page| page.select('#container input').each {|x|x.checked = true}}%>
e.g this will check the following checkboxes
<div id="container"> <input type="checkbox" name="loves[ruby]"> i love ruby <input type="checkbox" name="loves[rails]"> i love rails </div>
Hope this helps!
Cheery-O! Gustav gustav@rails.co.za itsdEx.com