I am trying to learn jQuery, by putting what I've learned into practice. So, here's my coding problem.
I have two buttons, one "yes" and one "no". Once the "Yes" radio button is selected, a new text input is to appear.
my jquery below:
$(document).ready(function(){
$("#many").hide();
var isChecked = $("#dform input" ).change(function() {
$("input[name=question]:checked", "#dform").val();
if(isChecked == yes){
$("#many").show();
}else {$("#many").hide();}
});
});
my code-pen
I used this answer added the value function in a variable, then used it in a conditional statement. I put the value $("input[name=question]:checked", "#dform").val();
in an alert to make sure that the value attached to the "yes" radio button has been captured. However, when I put the .val() function in a variable and use it in a conditional statement, it doesn't work.
Did I set the Jquery up correctly?