Main Question: Is it possible to use a JavaScript conditional and then use some jQuery code?
Here is a currently non-working example:
<script>
//<![CDATA[
if (location.pathname == "/SearchResults.asp"
|| location.pathname.indexOf("-s/") != -1
|| location.pathname.indexOf("_s/") != -1)
$('.colors_productname span').css("background-color", "#F7F7F7");
//]]>
</script>
The JavaScript conditional was provided by my ecommerce platform (Volusion) to target just category pages (the jQuery was my doing). I asked them if this JavaScript code would still work given that my urls dont include "/SearchResults.asp" (One of them is actually "/Meats-s/3393.htm"), but they assured me that it should still work.
Secondary Question: What do the "location.pathname.indexOf" lines do?