radio button combinations to show hidden DIVs
I have a similar task and created the page discussed. The script seems to display an OR result. Radio button A or radio button K cause the correct a-k DIV to appear. The problem is, I need an AND result. I need a DIV to appear only if both A and K are checked. The code originally posted is here:
- $(function() {
- $('a.button-show-advice').click(function() {
- var opts = '.advice-' + $('input:radio:checked'). // Extract advice selections
- map(function() { return $(this).val(); }).get().join(',.advice-');
- $('div.advice').hide().filter(opts).show(); // Hide all advices, then show matching ones
- return false;
- });
- });
In the HTML:
- <div class="advice advice-a advice-k">...</div>
- <div class="advice advice-b advice-k">...</div>
- <div class="advice advice-c advice-s">...</div>
Can anyone tell me how this could be modified to produce an AND result?