How To Show/hide Buttons In Questionnaire
I'm trying to get the buttons to dropdown with an if else show/hide /statement/function but I can't seem to get it to work. I've tried jquery and javascript but it doesn't seem to
Solution 1:
Your code is all messed up! Please use variable and id names that are easily understandable.
Here is a demo. Just select any answer for each question and see what happens. The button text is q1 q2 q3 q4
in that order.
You are using q4
to check for color when it is actually phone type and so no. I changed just enough to make you understand your problem.
$('#next_button').val("" + q1 + " " + q2 + " " + q3 + " " + q4); return;
//now check the values to display a different link for the desired configurationif (q1 == "AT&T" && q2 == "8GB" && q3 == "Black" && q4 == "iPhone-3GS") {
$('#next_button').val('att 8gb black').click(function () {
window.location.href = 'http://google.com/'
});
}
To show an hidden element use $(selector).show()
and to hide an element use $(selector).hide()
. Do not confuse with the IDs with the class name and the value you have provided to the elements.
Post a Comment for "How To Show/hide Buttons In Questionnaire"