CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   how do I unselect hidden buttons (http://www.codingforums.com/showthread.php?t=246308)

malcolm p 12-14-2011 07:10 AM

how do I unselect hidden buttons
 
Please follow these steps in my jsfiddle:

1. click on the (open grid) link and select option "13", buttons A to N would appear

2. click on the select all answers button, all buttons A to N would turn green.

3. Now click on the open grid again and select option "5". As you can see all the buttons from A to 5 are now selected (Have all turned green).

4. Now go back to grid and choose option 13. As you can see all buttons A to N would be selected. I don't want this to happen. What should happen is that the 5 buttons selected before the option change should remain selected and the other 8 buttons should go back being unselected, but I do not know how to do this.

I tried including this in the selectAll() function but it did not work:

Code:

$('.answerBtns:hidden').removeClass('answerBtnsOn').addClass('answerBtnsOff');
Does anyone have any ideas? Code is in jsfiddle, click [here][1]

Thank You


[1]: http://jsfiddle.net/C7vcQ/5/

devnull69 12-14-2011 08:52 AM

This is because the selectAll() method will only be invoked when actually clicking on the "Select All Answers" button. But you did not click it between step 3 and 4

What you should do: When you click on a grid button, toggle answerBtnsOn/answerBtnsOff for all the (A-Z) buttons not currently showing.

I've updated the fiddle


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.