user2386255
user2386255

Reputation: 17

Selecting more than one option

I have the following code working pretty well, but I want to be able to select more than one option if need be: http://jsfiddle.net/exlondoner/MKa3n/

Can anyone help?

JS:

$('.media-select-option').on('click', function() {
    $('.media-select-option').removeClass('selected');
    $(this).addClass('selected');     
    $('.m-overlay-close-btn').addClass('checked');       
});

Upvotes: 0

Views: 90

Answers (2)

Starx
Starx

Reputation: 78971

It is not working because there is no such element with class m-overlay-close-btn

$('.overlay-close-btn').addClass('checked');

Working fiddle

Upvotes: 1

palaѕн
palaѕн

Reputation: 73896

Try this:

$('.media-select-option').on('click', function () {
    $(this).toggleClass('selected');
    $('.m-overlay-close-btn').addClass('checked');
});

FIDDLE

Upvotes: 0

Related Questions