When the user clicks on the "Select All Buttons" button, it should display a number in the Number of answers text-box (.numberAnswerTxt) which is the number of buttons that are selected but it is not quite displaying this.

Follow the steps in my fiddle to be able to see what is happening:

Step 1: open the grid and select option "4". Buttons A to D would be displayed.

Step 2: Click on the "Select All buttons" buttons, this selects all the buttons A to D (they all turn green) and in the number of answers textbox it shows the number 4 as all 4 buttons are selected.

Step 3: Click on the "Add Question" button, This adds a new row showing the details you have entered.

Step 4: now open the grid again at the top and select option 6, Now click on the "Select All Answers" button, all 6 buttons have been selected (A to F) and the number of answers textbox displays the number 6.

Step 5: For the last time open the grid and select option 4 again, now you see 4 buttons (A to D) all selected yet the textbox still states 6 even though the it should display 4 as you only see 4 buttons selected.

So in the example above what needs to happen so that the number 4 is displayed except for the number 6?

code is in jsfiddle click http://jsfiddle.net/uXZcC/21/