Monday, September 29, 2008

[jQuery] getting value of a radio button

Hi all I know this is pretty basic stuff and discussed before but Im
having problems simply getting the value of a radio button that is
checked in a group.

For example in the code below why is 's' blank?

// get value for checkbox or radio button that is checked
$("input[@name='radCateg']").click(function(){
var s = $("input[@name='radCateg']:checked").val();
alert(s);
});

No comments: