I am trying to change the radio button according to a value entered by a user.
So if the value is 4 or more, I need to change the radio button to check the value Yes
.
Else to check No
.
Here is the script:
<td>a) Right <input type="text" class="form-control" style="width: 50px" name="right_result" id="right_result">/10 </td>
<td style="vertical-align: middle">
<input type="radio" class="radio-inline" name="monofilament_right_left" id="monofilament_right_left" value="Yes">Yes
<input type="radio" class="radio" name="monofilament_right_left" id="monofilament_right_left" value="No">No
</td>
And the jQuery script:
$("#right_result").on('keyup', function(){
var right_result = $("#right_result").val();
//console.log(right_result)
if(right_result>=4){
$('input[id="monofilament_right_left"]:checked').val("Yes")
}
})
The value is not changing when the user is adding the number in the text box.
I tried the solution