Ruby on Rails Thursday, December 27, 2012

The second selector is correct. Converting it to jQuery, it's 

$('input[data-radio-group="foo"]:checked').first().val();

-- 
Dheeraj Kumar

On Thursday 27 December 2012 at 10:50 PM, Walter Lee Davis wrote:


On Dec 27, 2012, at 12:14 PM, Walter Lee Davis wrote:


On Dec 27, 2012, at 6:33 AM, Gauthier D. wrote:

Compared to "real" radio groups, I loose the ability to quickly get the
"group value" but I don't need that in my case.

You might try this:

$$('input[data-radio-group="foo"][checked]').first().getValue();

Or maybe it's

$$('input[data-radio-group="foo"]:checked').first().getValue();

Try both.

Walter


That's Prototype, but you should be able to translate to jQuery -- they both use Sizzle under the hood, and the selector's the thing that matters here.

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment