Grant Bristow wrote:
> Thanks Rob.
>  
> But at the risk of sounding really stupid:  how do I put your code to 
> work?  I'm really sorry, but I've never seen the $. nomenclature 
> before.  Perhaps you could refer me to some additional documentation 
> than what I found on the jQuery site.  Or, just a short html page that 
> shows the relationship of the elements and the code.
>  
> Sorry to be a pain.  I have a feeling, reading the archives that I'm 
> missing some information.  Any help you could provide me (in terms of 
> places to look) would be appreciated.
>  
> Thank you again.
>  
> ----
> Grant
>
Example for Radio Checkbox Group

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Radio Checkbox Group</title>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

$.radioCheckboxGroup = function(element) {

    var x = $('[EMAIL PROTECTED]' + element + ']');

    x.click(function() {

        x.each(function() {

            this.checked = false;
        });

        this.checked = true;
    });

}


$(document).ready(function() {

    $.radioCheckboxGroup('stuff');

});
</script>
</head>
<body>
<h4>Radio Checkbox Group</h4>

<form name="testform">

<input type="checkbox" name="stuff" value="1" />
<input type="checkbox" name="stuff" value="2" />
<input type="checkbox" name="stuff" value="3" />
<input type="checkbox" name="stuff" value="4" />

</form>

</body>
</html>

Example for Select Deselect All

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Select Deselect All</title>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

$.selectDeselectAll = function(ctrl,element) {

    $('[EMAIL PROTECTED]' + ctrl + ']').click(function() {

        var x = this.checked;

        $('[EMAIL PROTECTED]' + element + ']').each(function() {

            this.checked = x;
        });
    });

}


$(document).ready(function() {

    $.selectDeselectAll('removeAll','remove[]');

});
</script>
</head>
<body>
<h4>Select/Deselect All</h4>

<form name="testform">

<input type="checkbox" name="remove[]" value="1" />
<input type="checkbox" name="remove[]" value="2" />
<input type="checkbox" name="remove[]" value="3" />
<input type="checkbox" name="remove[]" value="4" /><br />

<input type="checkbox" name="removeAll" value="" />

</form>
</body>
</html>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to