I have, what on initial viewing, is a simple requirement to show/hide
two divs
based on a users response to radio buttons.
See the JsFiddle: http://jsfiddle.net/P75cv/
The real complexity is as follows.
Div one
is to be shown if any of the questions has a radio button value of 2 or 1.
Div two
is only to be shown if any of the questions don't have a value of 2, 1 or -1.
However, I also need a further check to do the following, if div one
has been shown and a user goes back and changes their response so that no radio buttons have a value or 2 or 1, then div one
needs to be hidden and div two
shown. Similarly, if div two
is being shown but the user goes back and changes their responses so that any of the radio buttons have a value of 2 or 1, div two
needs to be hidden and div one
shown.
And finally, the user has the option of saving and coming back to the page - if they do, I need the right div to be shown based (on page load?).
The simple part of showing and hiding divs I can do, in both jQuery and Javascript but this level of complexity is really causing me a headache - can anyone offer an insights or solutions?