# Which Radio button value selected in Javascript?

**URL:** <https://forums.knack.com/t/which-radio-button-value-selected-in-javascript/7045>\
**Category:** Ask Developers\
**Created:** [June 21, 2018, 3:26pm UTC](https://forums.knack.com/t/which-radio-button-value-selected-in-javascript/7045 "2018-06-21T15:26:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulianSwal22288](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JulianSwal22288](https://forums.knack.com/u/JulianSwal22288)\
**Post date:** [June 21, 2018, 3:26pm UTC](https://forums.knack.com/t/which-radio-button-value-selected-in-javascript/7045/1 "2018-06-21T15:26:07Z")

</div>

I thought this would be simple, and I'm sure it is, once one knows the trick..

I have some javascript that I want to run and check the value of some selections.. I have two Yes/No field set as Radio button.

The below works for basic field.. I want to do the same thing to see if Yes or No has been selected by the user on the Radio button.

$(document).on('knack-view-render.view\_86', function(event, view, data) {  
 $("#view\_86 .kn-button").on("click", function() {  
 if ($("#field\_153").val() != "100.0000") {  
 alert ("Percentage total must equal 100%. Current value: " + Number($("#field\_153").val()) + "%");  
 return false;  
 }  
 })  
});

So I want something like this, but I already know that .val() returns undefined on these fields:

if ($("#field\_418").val() == "Yes" && $("field\_419").val() == "Yes") {  
 alert ("Field A and Field B cannot both be Yes");  
 return false;  
}

The fields in the browser look like this:

Thanks.
