0

Hi all I have a survey that when a box is checked it displays an answer based upon which answer you selected. I got this working and all, but am running into trouble when someone unchecks a box I want the div to go back to being hidden.

Here is the code I have written:

// if else statement for question 6
$("input[name='name_6[]']").bind("click", function(event){

    // If the value is equal to 25 or less show response 1
    if ($(this).val() <= 25) {
        $("#q6response1").slideDown('fast');
        $("#q6response2").hide();

}  // If the value is equal to 26 show response 2
    else if ($(this).val() == 26) {
        $("#q6response2").slideDown('fast');
        $("#q6response1").hide();

}
});

I tried using unbind and :checked, false and nothing seems to work. Any help would be great.

Thanks

1 Answer 1

0

Have you tried

// if else statement for question 6
$("input[name='name_6[]']").change(function(event){

    // If the value is equal to 25 or less show response 1
    if ($(this).val() <= 25) {
        $("#q6response1").slideDown('fast');
        $("#q6response2").hide();

    }  // If the value is equal to 26 show response 2
    else if ($(this).val() == 26) {
        $("#q6response2").slideDown('fast');
        $("#q6response1").hide();

  }
});
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.