in my question one suggested to do:
$(".entry").html(function(i, htm){
return htm.spli开发者_如何学Ct("-")[0];
});
To remove Approuved - Expire May 18 th 2012 but this remove
Source: SuperSite also and i would like to keep the source<div class="entry">
Published May 18th 2011 - Approuved - Expire May 18 th 2012<br>Source: SuperSite
</div>
I would like to remove Approuved - Expire May 18 th 2012
So the result would be:
<div class="entry">
Published May 18th 2011 <br>Source: SuperSite
</div>
$(".entry").html(function(i, htm){
var retStr = htm.split("-")[0]
return retStr+htm.split("<br>")[1];
});
You return only what is placed before the first '-'. You have to add what it's placed after
the <br>
tag.
Code snippet is only for give you an idea. It's a little bit dirty but you can start from it.
May ne you might try:
return htm.replace(/-[^<]+?/, '');
精彩评论