Even though the second radio button is set with the "checked" attribute, the jQuery snippet above always returns the value of the first radio button. I am obviously doing something wrong (again), but cannot seem to pinpoint the error of my ways.
> Even though the second radio button is set with the "checked" > attribute, the jQuery snippet above always returns the value of the > first radio button. I am obviously doing something wrong (again), but > cannot seem to pinpoint the error of my ways.
> As always, thanks in advance for your assistance.
Thank you for your responses. It really annoys the hell out of me that Gmail and Google Groups both delayed your messages until I had already found the answer in the docs, and yet the timestamps are long before they showed up. I even blogged about it (link below).
> > Even though the second radio button is set with the "checked"
> > attribute, the jQuery snippet above always returns the value of the
> > first radio button. I am obviously doing something wrong (again), but
> > cannot seem to pinpoint the error of my ways.
> > As always, thanks in advance for your assistance.
> On Jan 23, 11:35 am, Timothee Groleau <timothee.grol...@muvee.com> > wrote: > > Hi Matt,
> > On Wed, 2008-01-23 at 03:22 -0600, Matt Quackenbush wrote: > > > Hello,
> > > I am using the following to grab the value of a radio button:
> > > str = $("input[name='addType']").val();
> > .val() returns the value of the first match element and your query > > matches both radio buttons. If you want to target only the checked one, > > try:
> > str = $("input[name=addType]:checked").val();
> > hth, > > Tim.
> > > The XHTML for the radio button is as follows:
> > > Even though the second radio button is set with the "checked" > > > attribute, the jQuery snippet above always returns the value of the > > > first radio button. I am obviously doing something wrong (again), but > > > cannot seem to pinpoint the error of my ways.
> > > As always, thanks in advance for your assistance.