I'm making an ajax call that retweets the Html of filters to be put on a particular div. However I would like to remove some html elements previously. For that I passed the html to jQuery, thus turning it into an array. After removing the elements you would like to resume the concatenated html.
I'm currently doing this:
msg = jQuery(msg);
var index = 0;
var html = '';
msg.each(function(i, _this){
if(jQuery(_this).find('input[type="submit"]').size() == 1){
index = i;
return;
}
});
msg.splice(index,2);
msg.each(function(){
html += this.outerHTML
});
But I'm not very happy with the development, would anyone know how to make this function better?