I've got a function I am running on a jQuery object using .each(). Except, if a certain test passes, I actually want to run the function on the parent of the node in the current iteration. However, when I try to switch contexts, I get an assignment error or endless loop.
Here is the code that does not work:
$(this).each(function() {
if($(this).attr("title")) {
content = $(this).attr("title");
$(this) = $(this).parent();
} else {
content = $(this).html();
}
//other stuff
}