if(hash=="ref=projects") {
$("a#pj-title").addClass("selected-part");
$.ajax({url:"/project.html",
dataType:"html",
beforeSend:function(){
$(".loading").prepend('<div class="attention"><img src="ajax-loader.gif" /></div>')
},
success:function(a) {
$("#rv-container").html(a)
}
})
}
Why doesn’t the addClass method work? It doesn’t seem to work within the if statement.
If
hashis fromwindow.location.hash, then it will include a leading#so your code would need to be:Also,
$("a#pj-title")may be faster if it’s$("#pj-title")since that lets jQuery usedocument.getElementById()as a shortcut and since there’s only one object with a given ID anyway, you shouldn’t need theaon the front anyway.