How can I select texts that are not surrounded by HTML tags, but simply preceding and following <br>
tags ?
I did it with xpath:
.xpath('//br/following-sibling::text()|//br/preceding-sibling::text()')
How can I select texts that are not surrounded by HTML tags, but simply preceding and following <br>
tags ?
I did it with xpath:
.xpath('//br/following-sibling::text()|//br/preceding-sibling::text()')
var text = "";
$("br").parent().contents().each(function(i) {
if(this.nodeName == "#text")
{
text += this.textContent;
}
});
alert(text);
--->
<span>bla bla bl<br/>a bla...</span> --> bla bla bla bla...