I believe the remove function is really synchronous though, which is why this is so confusing.
I have a list of divs with a span3
class. The divs can be removed. The first occurrence of a div with span3
must always have the first
class
If the div that currently has the first
class is removed, by calling:
$('#'+id).remove();
and the first is reassigned by calling:
$('.span3').first().addClass('first');
Why does the first occurence of .span3 only sometimes get assigned the first
class?
The full snippet:
$.get('someFile.php', function(data) {
$('#'+id).remove();
$('.span3').first().addClass('first');
});