Tuesday, January 27, 2009

[jQuery] Re: .val() problem

2 observations

1) is fieldsubmcategory meant to have the "m" ?
2) is either fieldsubmcategory or value a literal ? Do you need to do something like:

"input:radio[name="+field_submcategory[value]+"]:checked"  or 
"input:radio[name=field_submcategory["+value+"]]:checked"

Liam

LoicDuros wrote:
Hi Ricardo,  Although I escaped the brackets, my alert is still displaying "Undefined" for the value of radio buttons: alert($('input:radio[name=field_submcategory\\[value\\]]:checked').val ());  could it be something else?  Thanks,   On Jan 26, 3:06 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote:   
I think you have to escape the brackets:  $('input:radio[name=field_submcategory\\[value\\]]:checked').val()  On Jan 26, 3:37 pm, LoicDuros <loic.du...@gmail.com> wrote:      
Hi,       
I have a set of radio buttons with name="field_submcategory[value]" I want to figure out what value has been selected, even after the user hits refresh (so .change won't work). I've tried this but the alert I get is always undefined, independently from what button is checked: alert($('input:radio[name=field_submcategory[value]]:checked').val());       
Thanks!
 
No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.10.14/1918 - Release Date: 27/01/2009 07:26

No comments: