Anyway, I knew the solution was to use the kick ass power of Jquery I just didn't know how the hell to accomplish this task. The solution was to use ideas from this kick ass Jquery plugin:
http://www.itsalif.info/content/ezmark-jquery-checkbox-radiobutton-plugin
My working solution below... The magic is in Jquery's trigger() function which will pragmatically simulate a human event.
<form action="#" method="post" id="myform">
<fieldset>
<input name="checkall" id="checkall" type="checkbox">
<input name="checkbox1" onchange="DO SOMETHING...." id="checkbox1" type="checkbox">
<input name="checkbox2" id="checkbox2" type="checkbox">
<input name="checkbox3" id="checkbox3" type="checkbox">
<input name="checkbox4" id="checkbox4" type="checkbox">
<input name="checkbox5" id="checkbox5" type="checkbox">
<input name="checkbox6" id="checkbox6" type="checkbox">
<input name="checkbox7" id="checkbox7" type="checkbox">
<input name="checkbox8" id="checkbox8" type="checkbox">
<input name="checkbox9" id="checkbox9" type="checkbox">
<input name="checkbox10" id="checkbox10" type="checkbox">
</fieldset>
</form>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript"><br />$(function () {<br /> $('#checkall').click(function () {<br /> $(this).parents('fieldset:eq(0)').find(':checkbox').attr('checked', this.checked).trigger('change');<br /> <br /> });<br />});<br /></script>
No comments:
Post a Comment