Reputation: 3052
I have search results and they are concatenated with multiple words at the beginning of the sentence.
<div itemprop="articleSection" class="entry-summary">
WHAT WE DOSource Integrate Support Manage Transform A metre-wide “lazy river” of cobblestones meanders through the clay-paved plaza fronting Australia’s newest international-standard swim centre.
</div>
I want to remove the words "WHAT WE DOSource Integrate Support Manage Transform" from the beginning of EACH class="entry-summary"
Thanks!
Upvotes: 0
Views: 164
Reputation: 9739
You can use this jQuery
jQuery
$('.entry-summary').each(function() {
var text = $(this).text();
$(this).text(text.replace('WHAT WE DOSource Integrate Support Manage Transform', ''));
});
Upvotes: 2
Reputation: 74420
You could just split it:
$('.entry-summary:contains("Transform ")').text(function(_, txt){
return txt.split('Transform ')[1];
});
Upvotes: 0
Reputation: 579
You can Use str_replace function.
var str = $(".entry-summary").html();
var res = str.replace("WHAT WE DOSource Integrate Support Manage Transform", "");
$(".entry-summary").html(res);
Upvotes: 0
Reputation: 816384
Use the .text
method to change the text:
$('.entry-summary').text(function(index, value) {
return value.replace(
/^\s*WHAT WE DOSource Integrate Support Manage Transform/,
''
);
});
Upvotes: 1