I have to show different divs based on what search terms are entered into my site. The URL will contain the search term entered, so I thought I could check for the string in the URL and show the div if there is a match.
For the Doufeu/doufeu part, the div will only show based on the first term. The code is below - it will only show if Doufeu is in the string, but not doufeu. Why?
Based on what I read here and here, I have tried the code below, and also using && instead of || because the second link explains the second condition is only read if the first one is false. I found this and also tried separating with a comma. None work for me though. Here is where I am now:
<script type="text/javascript">
$(document).ready(function(){
if ((window.location.href.indexOf("searchTerm=Doufeu" || "searchTerm=doufeu") > -1)){
$("#learn-doufeu").show();
}
else {
$("#ci-guide").show();
}
});
</script>
I know I could make a new if else condition and separate Doufeu from doufeu that way but surely there is a way to do it with OR.