Hi,
I would like to add a class to the <li> or <a> tag when a particular link is clicked. This is the html,
Code:
<ul>
<li><a href="#" onclick="loadPage('1.php'); return false;">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
</ul>
jquey's ajax,
Code:
function loadPage(parameter) {
this.addClass('current');
$("#content").html('<div id="ajaxloader"><p><img src="img_iconies/loader_0.gif"/> loading...</p></div>');
$("#content").load( "incl_contents/" + parameter, {}, function(){ //calling the ajax then with a callback afterwards
$("#content").css({display:'none'})
.fadeIn("slow");
});
}
it works fine until i put this line in,
Code:
this.addClass('current');
I think it is probably it is incorrect the way i try to add the class to the link.
Many thanks if u have any ideas.
Lau