I have checked my javascript and it shows no error, but it is not doing anything at all.
Here is the html code:
<body>
<!--The div who's function isn't working-->
<div id="sliderButtonB" onclick='pageSliderBack()'>Go Back</div>
<!--End of not-functioning div-->
<!--The Slider That is supposed to change **backwards** -->
<div id='slidecarousel' class='p1' onclick='pageSlider(this)'>
...
...
...
</div>
</body>
Here is the not-functioning javascript:
function pageSliderBack(){
var pDiv = $('#slidecarousel')
if ( pDiv.attr("class").match(/(?:^|\s)p1(?!\S)/) ){
pDiv.className = "p5";
} else if ( pDiv.attr("class").match(/(?:^|\s)p2(?!\S)/) ){
pDiv.className = "p1";
} else if ( pDiv.attr("class").match(/(?:^|\s)p3(?!\S)/) ){
pDiv.className = "p2";
} else if ( pDiv.attr("class").match(/(?:^|\s)p4(?!\S)/) ){
pDiv.className = "p3";
} else if ( pDiv.attr("class").match(/(?:^|\s)p5(?!\S)/) ){
pDiv.className = "p4";
} else {
pDiv.className = "SlideErr";
}
}
Here is the rest of the javascript on the page; This function works, but the other doesn't:
function pageSlider(elem){
if ( elem.className.match(/(?:^|\s)p1(?!\S)/) ){
elem.className = "p2";
} else if ( elem.className.match(/(?:^|\s)p2(?!\S)/) ){
elem.className = "p3";
} else if ( elem.className.match(/(?:^|\s)p3(?!\S)/) ){
elem.className = "p4";
} else if ( elem.className.match(/(?:^|\s)p4(?!\S)/) ){
elem.className = "p5";
} else if ( elem.className.match(/(?:^|\s)p5(?!\S)/) ){
elem.className = "p1";
} else {
elem.className = "SlideErr";
}
}