I am trying to modify DOM elements but for some reason the code gets jammed up.
var length = tabOne.length;
for(var i = 0; i < length; i++) {
if(tabOne[i] == sPage){
alert("In Tab One");
// Set the top nav link as current (Get the first link in #nav-main)
$("#nav-main a:first").addClass("current");
// Set the sub nav link as current (Find it by URL)
$("a[href='" + sPage + "']").addClass("current");
// Show the sub nav
$("#nav-sub-welcome").css('display', '');
alert("We got this far");
}
}
The script never displays the alert at the end. I tried commenting out specific manipulations but for some reason the alert wont run unless they are all commented out. Any help is appreciated!!
The problem was that the page this code was being used on was also loading prototype, and they conflicted. Read this to learn how to avoid conflicts.