I am using the following script for a form
<script type="text/javascript">
$(document).ready(function(){
$('input[type="radio"]').click(function(){
if($(this).attr("value")=="Q1YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q2YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q3YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q4YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q5YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q5NO"){
$(".box").hide();
$(".no").show();
}
});
});
</script>
If the user checks the YES radio button to any question it will show the YES Div - if they click NO to the last question it will show the NO div.
What i really want is for this to be if they click YES to any question show the YES div and if they click NO to all the questions only then show the NO div (triggered on the last radio filed)
I have tried
if($(this).attr("value")=="Q1NO") && if($(this).attr("value")=="Q2NO") && if($(this).attr("value")=="Q3NO") && if($(this).attr("value")=="Q4NO") && if($(this).attr("value")=="Q5NO") {
$(".box").hide();
$(".no").show();
}
but it does not work
likewise i have tried
if($(this).attr("value")=="Q1NO") || if($(this).attr("value")=="Q2NO") || if($(this).attr("value")=="Q3NO") || if($(this).attr("value")=="Q4NO") || if($(this).attr("value")=="Q5NO") {
$(".box").hide();
$(".yes").show();
}
for the Yes part and this does not work
any ideas?
<script type="text/javascript">
$(document).ready(function(){
$('input[type="radio"]').click(function(){
if($(this).attr("value")=="Q1YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q2YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q3YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q4YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q5YES"){
$(".box").hide();
$(".yes").show();
}
if($(this).attr("value")=="Q5NO"){
$(".box").hide();
$(".no").show();
}
});
});
</script>
If the user checks the YES radio button to any question it will show the YES Div - if they click NO to the last question it will show the NO div.
What i really want is for this to be if they click YES to any question show the YES div and if they click NO to all the questions only then show the NO div (triggered on the last radio filed)
I have tried
if($(this).attr("value")=="Q1NO") && if($(this).attr("value")=="Q2NO") && if($(this).attr("value")=="Q3NO") && if($(this).attr("value")=="Q4NO") && if($(this).attr("value")=="Q5NO") {
$(".box").hide();
$(".no").show();
}
but it does not work
likewise i have tried
if($(this).attr("value")=="Q1NO") || if($(this).attr("value")=="Q2NO") || if($(this).attr("value")=="Q3NO") || if($(this).attr("value")=="Q4NO") || if($(this).attr("value")=="Q5NO") {
$(".box").hide();
$(".yes").show();
}
for the Yes part and this does not work
any ideas?