$("br").parent().contents().each(function(i) {
if(this.nodeType == "#Text")
{
alert(this.textContent);
}
});
i am trying to select all texts not surrounded by html tags, but separated via <br>
doing this, sometimes returns a lot of alert messages, even when there should only be a couple.
i have tried to filter it out using
if(this.nodeValue != "") or if(this.textContent != "")
but still, empty alert messages pop up.
I suspect its the whitespaces in the html document (i dont control it). I only want to display this.textContent
, which actually has visible text.