Reputation: 315
I have this code, this works with a word, but i want to add multi words, example, "one", "two", "three" etc..
$(document).ready(function () {
if(window.location.href.indexOf("one") > -1) {
$( ".hideif" ).hide();
}
});
some help thank you.
Upvotes: 0
Views: 125
Reputation: 371233
Use an array and see if some
of the words in the array are .include
d in the href
:
$(document).ready(function () {
const words = ['one', 'two', three'];
if (words.some(word => window.location.href.includes(word))) {
$( ".hideif" ).hide();
}
});
Upvotes: 2