If the URL is something, do something
Hi,
What I'm trying to do is create three rules depending on the path of a page. If the path contains 'best-sellers', I want jQuery to set the class of the page to 'pm-best-sellers'. I can do this, and it works, but when I add the rules for 'express-gifts' and 'eco-friendly' it breaks.
Here's what I've got:
 
 - 
  $(document).ready(function() {
 
 var url = location.pathname;
 
 if ("url:contains('best-sellers')") {
 $("body").attr("class","pm-best-sellers");
 }
 
 else if ("url:contains('express-gifts')") {
 $("body").attr("class","pm-express-gifts");
 }
 
 else ("url:contains('eco-friendly')") {
 $("body").attr("class","eco-friendly");
 }
 
 });
I'm not sure if this is really a jQuery specific problem but as jQuery is what allows me to do any JavaScript whatsoever I thought this would be a good place to ask.
Can anyone spot what's wrong here?
Thanks for reading,
Scott.