Is is possible remove all content before a s开发者_运维知识库pecific string with jquery? For instance say I wanted to strip all the text before the word "subcommittee" in this example below. How would I do that?
With losses mounting among hoteliers, fishermen and others whose livelihoods have been curtailed by the spill, frustration is "rapidly escalating" along the Gulf Coast alive."
Linn told a House Energy and Commerce subcommittee Monday that the amount of money BP has paid local residents for their losses has typically been about $5,000, a sum he dismissed as "a marketing ploy." Businesses such as his vacation rental company are borrowing money to pay their overhead costs, which he called "the only way we're going to keep our business alive."
you dont need jquery for this... but ill play along
var text = $("#myText").text();
text = text.substring(text.indexOf("subcommittee"));
$("#myText").text(text);
something like that.
Just use indexOf()
to find out the position of the given string in the text and use substring()
to get a piece of the text from the given position on.
var text = element.text();
var filtered = text.substring(text.indexOf('subcommittee'));
精彩评论