i am having the code like
<input type="checkbox" class="selectionne" id="first" value="1">
<input type="checkbox" class="selectionne" id="second" value="2">
<input type="checkbox" class="selectionne" id="second" value="3">
<input type="checkbox" class="selectionne" id="second" value="4">
<input type="checkbox" class="selectionne" id="second" value="5">
<input type="checkbox" class="selectionne" id="second" value="6">
jquery
var elems = [];
$('.selectionne').change(function(){
this.checked ? elems.push($(this).val()) : elems.pop($(this).val());
alert(elems);
});
Actually am pushing values to var elems by ckecking the checkboxes.pushing happening properly, But poping is happening like how i pushed values like 1,2,3,4,5 in reverse order its poping. i dont want like that, if i check randomly also it has to pop randomly only..
check here jsfiddle its working like wat i was explained. i want to pop randomly after unchecking check boxes....
plz help me out.. thanks in advance...