Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Find out the checked radio button


Message #1 by "Bharat Saboo" <bharatsaboo@h...> on Mon, 25 Feb 2002 12:36:48 +0530
Use the checked property:
checkboxes:
if (checkbox.checked)
        alert("seelcted");
else
        alert("not selected");

radio buttons:
function getRadioSelection(radioObject) {
	var value = null;
	for (var i=0; i<radioObject.length; i++) {
		if (radioObject[i].checked) {
			value = radioObject[i].value;
			break;
		}
	}
	return value;
}
HTH
Phil

> Hi all
> 
> 
> Can anyone tell how to find out which radio button a user has checked 
> out of
> the options without submitting the forms.  The same answer is also 
> required
> for checkboxes.
> 
> thnx
> 
> Bharat


  Return to Index