Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Some selected buttons should go back being unselected

    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/

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,145
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    It also doesn't change "Number of answers" from 13 to 5 when you do step 3.

    But you said this is a JavaScript question and all the code is jQuery. So I'd post in the jQuery forum were I you.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •