toggle function to limited tags on click event
I have 10 boxes, I have added toggle functions to it to select the box by adding class 'active'. I want to let user to select only 6 boxes. When user selects 6 boxes it not letting to select others which is working fine. My problem is I want to change my selection again but it is not letting me to do that. Below is code:
- $('a').click(function(){
- if($('.active').length < 6) {
- $(this).toggleClass('active')
- }
- })
I want to change my selection, please help!