peace folks, I have this small piece of jquery based code, that grabs all tags that has class “foo” and their childs and assign them some value, my question how could i get this working in the same exact way but not using jquery, but native javascript
jQuery.each(data.results, function(index, value) {
jQuery(".foo").find("*")
.andSelf()
.contents()
.filter(function(){
return this.nodeType === 3;
})
.filter(function(){
// Only match when contains 'simple string' anywhere in the text
if (value.origin != ""){
return this.nodeValue === (value.origin);
}
})
.each(function(){
this.nodeValue = "assign me";
});});
It’ hard to see what exactly you are trying to do here, but here are a couple of functions that might help you and an example of their use (as I understand your requirement)
USE:
A couple of points on your original
better jQuery