We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

penguin999 on 07/24/07


Tagged

jquery radio selector


Versions (?)


Who likes this?

7 people have marked this snippet as a favorite

omixen
francisre
heinz1959
AgentPhoenix
yetanother
martingoldszein
jasonseney


Radio button values using jquery


Published in: JavaScript 


  1. Both of these versions work for me:
  2.  
  3. var var_name = $("input[@name=radio_name]:checked").val();
  4.  
  5. var var_name = $("input[@name='radio_name']:checked").val();

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: omixen on April 16, 2008

Can you put single quote around 'radio_name' ? They should have this on jQuery site. :)

Posted By: omixen on April 16, 2008

Can you put single quote around 'radio_name' ? They should have this on jQuery site. :)

Posted By: jasonseney on October 15, 2008

Is it possible to edit your own snippet? Im not sure if penguin999 could even add the single quotes. I hope we can edit posts!

Posted By: omixen on October 21, 2008

I think only original author could edit them. I have to create a new one since I use this snippet on my blog.

Posted By: omixen on October 21, 2008

sorry to promote my own snippet, I just added the single quotes there:

http://snipplr.com/view/9166/get-radio-button-value-using-jquery/

You need to login to post a comment.