1
Boas, I have the problem that I have 6 checkbox but can only select a maximum of 2 before submitting the form. What happens is that by clicking on the third box it gives the message and clears the previous two and the third one is selected, and I can’t deselect on all 5 checkboxes with the iCkeck plugin.
	$('.selcheck').on('ifChecked', function(event){
		
		if ($('.selcheck').filter(':checked').length > 2 ) {
			
			alert('Só é permitido escolher 2 opções.');
						
			$('#d1, #d2, #d3, #d4, #d5, #d6').iCheck('uncheck');
			
		}
	
	});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<input id='d1' type='checkbox' class='selcheck'/>
<input id='d2' type='checkbox' class='selcheck'/>
<input id='d3' type='checkbox' class='selcheck'/>
<input id='d4' type='checkbox' class='selcheck'/>
<input id='d5' type='checkbox' class='selcheck'/>Solution:
    $('.selcheck').on('ifChecked', function(event){
    var limpa = 0;
    if ($('.selcheck').filter(':checked').length > 2 ) {
        alert('Só é permitido escolher 2 opções.');
        limpa = 1;
    }
    $(function() {
        if (limpa == 1){
            $('.selcheck').iCheck('uncheck');
        }
    });
});
Hi I use icheck not only to uncheck but also for css
– Sergio Teixeira
And what mistake is it
iCheckspawned?– Victor Carnaval
Vitor gave no error, clicking on the 3 box, after the message clears the two boxes selected and the 3 box is selected.
– Sergio Teixeira
The solution I posted doesn’t solve your problem?
– Victor Carnaval
Viva didn’t solve it, but I’ve already solved thank you.
– Sergio Teixeira