/    Sign up×
Community /Pin to ProfileBookmark

Help with multiple text().search

How can I properly search for a text string using the below statement in 1 row with many searches without redundantly using the same code.

example I use now to find a string on the page and add a starburst to a thumbnail product.
`
// ##### 20% OFF HOLIDAY SALE
if ($(this).text().search(“Mystical Stealie Tie-Dye T-Shirt”) >=0 )
{
$(‘.ProductMobileThumbContainer’, this).before(‘<img class=”OnSaleItemBadgeMobileThumb” src=”https://liquidblue.com/template/images/_gui/20OFF.gif”>’);
}
`

I would rather search multiple products names in the first row instead of copying the entire block many times.
so something like adding && in between the 2 products strings?

` if ($(this).text().search(“Mystical Stealie Tie-Dye T-Shirt”) && (“Bright Side of the Moon”) >=0 )
`

AND OR so it can hold many strings in 1 row?

any help would allow me to eat turkey this thanksgiving.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @liquidblue spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...