[jQuery] Problems selecting elements...
I've been beating my head over this code for quite some time. I was
hoping somewhere here can send me on the right direction...
Here is my jQuery Code:
$(document).ready(function()
{
// Dynamically Configures the active link based on ID attribute in
body tag
var pageIndex = $("body").attr("id"); // Pulls ID value from body
tag
pageIndex = pageIndex.substring(4); // Extracts Index from value
$("#nav_container ul span").slice(pageIndex, pageIndex+1).addClass
("activeLink").prepend(">");
});
Here is a basic example of the applicable Markup:
<body id="link1">
<table>
<tr>
<td id="nav_container">
<ul>
<span> > <a href="..." >Link 1</a></span>
<span> > <a href="..." >Link 2</a></span>
<span> > <a href="..." >Link 3</a></span>
<ul>
</td>
</tr>
</table>
</body>
Basically, what I want to happen is to have jQuery determine the page
it's on by pulling and parsing the data stored in the body's id tag.
Then using that data, apply the appropriate changes to navigational
link for the page it's on. This way users can tell which page they are
on.
Also, please don't bash me for using tables. This is for college
assignment and the markup was part of the requirement...
Also, please don't post any solutions involving changing the ul list
section. The <ul> tag is pulled in using a php include so any changes
there will have a global affect on my site.