Hi I'm trying to get the IDs of all DIVs, inside another HTML File, with a specific Class. To load the file I use:
$.get("blocks.html", function(data) {
//here I don't know how :)
});
Now what I'm looking for ist something like this:
data.$('.block').each(... the rest is no problem
so that I use the jQuery selectors not on my page code but instead inside the contend of the data variable. Thanks for help!
$.get("blocks.html", function(data) {
var ids = $('<div/>').html(data).find('div.block').map(function() {
return this.id;
}).get();
});
Try this:
$.get("blocks.html", function(data) {
$(data).find('.block').each(function(){...});
});
If your 'data html' containing element is a '.block', look at @undefined's answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With