As you do this, you are looking for elements divinside the transferred elements. Basically equivalent to execution .find().
You want filter()one that will filter the top-level items in the collection you submitted.
Check here: http://jsfiddle.net/u5uDg/
var mystring = '<div> bleh content </div> <div> bleh content </div>';
$(mystring).filter('div').each(function(e) {
alert('do something');
});
If you want to use your approach, you need to provide the elements with a divparent element on which jQuery can search.
http://jsfiddle.net/u5uDg/1/
var mystring = '<div><div> bleh content </div> <div> bleh content </div></div>';
$('div', mystring).each(function(e) {
alert('do something');
});
.each() setTimeout() , , .
http://jsfiddle.net/u5uDg/6/
var mystring = '<div> bleh content </div> <div> bleh content </div>';
var length = $(mystring).filter('div').length;
$(mystring).filter('div').each(function(e) {
(function(th) {
setTimeout(function() {
alert($(th).text());
if(!--length) { alert('done'); }
}, e * 2000);
}(this));
});