I'm facing a challenge with what seems like a straightforward question, but I just can't seem to figure it out.
All I am trying to accomplish is to incorporate some javascript into the webpage that assigns a class to the main page container based on the URL.
Let's take, for example, a site located at root.com and having the following HTML structure (roughly speaking):
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<div id="main" class="wrapper">
Blah, blah, blah
</body>
</html>
What I aim to achieve is a script that, when the page equals something like root.com/technology, will apply a class to the main div. This would result in the div appearing as follows:
<div id="main" class="wrapper tech">
Since I have loaded jQuery, I prefer to use it for this task.