I have a web page like this:
<p class="author">By ... on Jan 23, 2012</p>
<p class="content">(some content)</p>
<p class="author">By ... on Jan 23, 2012</p>
<p class="content">(some content)</p>
<p class="author">By ... on Jan 23, 2012</p>
<p class="content">(some content)</p>
...
I would like to use jquery to remove the words "By" and "on" from p.author, the result would be:
<p class="author">... Jan 23, 2012</p>
<p class="content">(some content)</p>
...
Thanks!
$('.author').each(function(){
$(this).text($(this).text().replace(/on|by/g,""))
});
$(".author").each( function(){
var text = this.firstChild.nodeValue;
this.firstChild.nodeValue = text.replace( /(^By|\bon\b)/g, "" );
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With