javascript - Remove string after predefined string -
i pulling content rss feed, before using jquery format , edit rss feed (string) returned. using replace replace strings , characters so:
var spanish = $("#wod a").text(); var newspan = spanish.replace("=","-"); $("#wod a").text(newspan); this works great. trying remove text after point. similar truncation, hide text starting word "example".
in particular rss feed, word example in every feed. hide "example" , text follows word. how can accomplish this?
though there not enough jquery, don't need remove after word in given string. first approach use substring:
var new_str = str.substring(0, str.indexof("example")); the second trick split:
var new_str = str.split("example")[0];
Comments
Post a Comment