3
Folks I’m needing to alphabetically classify a div
, use the following strategy, put in a div
with display: none
I have read them all, so after inserting all the html
, I do the while
for as long as you have li
in that div
it will check which is larger, the larger, identifying it adds in another div
, that’s like display:block
after I removed the div
with display:none
and stay in this loop.
My code is following:
while($('#check_presencaNone li').length > '0'){
$('#check_presencaNone li').each(function(i){
if($(this).text().toUpperCase() < valor){
valor = $(this).text().toUpperCase();
ponteiro = $(this);
}
});
ponteiro.clone().appendTo('#check_presenca');
ponteiro.remove();
console.log($('#check_presencaNone li').length);
}
While running is getting in an infinite loop, and I’m not able to identify the error. What’s wrong ?
first I would not use so '0' and yes without the quotes ... as the length is int .... use the 0 without quotes tbm int. something else ... in this case $('#check_presencaNone li'). length You need to go down it ne to get to the point where it zeroes .... the way this one will loop infinitely even
– Otto
How decrease ? Because for me the lenght would solve, what would be the editions proposed by you ?
– Renan Rodrigues
Because the idea is to remove it, remove the line that has already been ordered in the case. I need to actually sort the div.
– Renan Rodrigues
understood master ... Voce could set an example to work so we can help ?
– Otto
Xii, it’s hard because it’s something dynamic
– Renan Rodrigues
But I’ll try.
– Renan Rodrigues
I understand that it is difficult to make an example of this ... but we agree that without it is also complicated right, having the whole vision to try to find the problem
– Otto
https://jsfiddle.net/a79vn0jx/ This is where I got it
– Renan Rodrigues
Let’s go continue this discussion in chat.
– Otto