Posts: 41
Name: Scott Brown
Location: Huddersfield, UK
|
Hi,
I have a page where I cannot edit the html directly so am doing a lot of chopping and changing with jQuery.
What I need to happen is for javascript/jquery to apply a class to the body tag if the url contains something. For example:
if the URL contains "best-sellers", I want the body tag to be <body class="best-sellers">.
I've used jqURL which allowed me to do what I wanted but at massively bloated file sizes as I had to define the whole url for each rule. Also, each page where I want this to be applied can be accessed on 4 (slightly) different addresses. The common theme between these is the text 'best-sellers' which is why I want to target that.
I've tried probably 20-30 different ways of marking this up, changing syntax, using jQuery, not using jQuery and so on. If someone's got any idea how to go about this I'd be most grateful if they told me!
Cheers guys,
Scott.
|