Limit values displayed in jquery

0

How do I "limit the amount of values sorted by for below?"

I tried to create an array with the Divs and change the display property .. however it does not take the order of the elements ..

Much of this code has been removed from a previous topic.

// Seleciona as divs que queremos ordenar
var divs = document.querySelectorAll('#res .alqb');

// Converte a NodeList de divs para array

var ordem = [].map.call(divs, function(element) {
    return element;

});

// Ordena a array pelo atributo 'value'
ordem.sort(function(a,b) {
    var ca = parseInt(a.getAttribute('value'), 10);
    var cb = parseInt(b.getAttribute('value'), 10);
    return cb - ca;
});


// Reinsere os filhos no pai, resultando na ordem desejada
var container = document.querySelector('#res');
for(var i=0; i<ordem.length; i++) {
    container.appendChild(ordem[i]); 
}  
trocacorresp();
qtdjogo();
}
    
asked by anonymous 27.01.2017 / 16:13

0 answers