I'm trying to check my page's <title> tag for certain key words, to show/hide a div. Each state (4 states) have 4 differrent keywords they could have in the title. I'm trying to figure out how I can write my if statement so it says
If title has "word 1" or "word 2" or "word 3" or "word 4" do this function
Currently, I have it written like this:
if ($("title").text() == "Marketing" || "Marketing Product Support" || "Inbound Marketing Best Practices" || "Marketing Certification Help") {
$('.marketing-board-header').show();
}
if ($("title").text() == "Sales" || "Sales Product Support" || "Inbound Sales Best Practices" || "Sales Certification Help") {
$('.sales-board-header').show();
}
if ($("title").text() == "COS Design" || "COS Design Support" || "Share Your Work" || "Design Certification Help") {
$('.design-board-header').show();
}
if ($("title").text() == "community Ideas") {
$('.idea-board-header').show();
}
But this doesn't seem to hide/show the divs I'd like, am I missing something? or is there a better way to do this?
Thanks for the help!
Aucun commentaire:
Enregistrer un commentaire