{"id":645,"date":"2012-05-29T09:00:04","date_gmt":"2012-05-29T09:00:04","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=645"},"modified":"2012-05-29T09:00:04","modified_gmt":"2012-05-29T09:00:04","slug":"jquery-selected-radio-get-selected-radio-button-value-1-line-code","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/jquery-selected-radio-get-selected-radio-button-value-1-line-code\/","title":{"rendered":"jQuery Selected Radio Button Value Examples (1 line code)"},"content":{"rendered":"<p>Have you ever wondered how to use\u00a0<strong><em>jQuery to \u00a0get selected radio value<\/em><\/strong>? In this article, I am going to show you two easy and simple ways to do that. Each method has only 1 line of code, so it&#8217;s super duper easy to follow along and implement it.<!--more--><\/p>\n<h2>How to Get Selected Radio Button Value using jQuery &#8211; Examples<\/h2>\n<p>Let&#8217;s say that you have a form with ID: &#8220;form1&#8221; and &#8220;country&#8221; is the ID radio button for which you are trying to find out the selected value. Now here are the 2 ways in which you can use do it:<\/p>\n<h3>Example 1: Using :checked<\/h3>\n<pre class=\"lang:xhtml decode:true\">$('#form1 input[name=country]:checked');<\/pre>\n<h3>Example 2: Using .val()<\/h3>\n<pre class=\"lang:xhtml decode:true\">$('input[name=country]:checked', '#form1').val();<\/pre>\n<h5>That&#8217;s it!<\/h5>\n<p>Do you know of any other ways to use\u00a0<strong><em>jQuery to get selected radio button value<\/em><\/strong>? Feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wondered how to use\u00a0jQuery to \u00a0get selected radio value? In this article, I am going to show you two easy and simple ways to do that. Each method has only 1 line of code, so it&#8217;s super duper easy to follow along and implement it.<\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,13],"tags":[41],"class_list":["post-645","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery-tips-and-tricks","category-tips-and-tricks","tag-jquery-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-ap","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}