I am having some difficulty using the load method to load new content to a li element. When i try to use this the new content prepends to the element, that is gets added to the top instead of replacing the current content. Here is the element layout
<!-- List The News Items mainPage.php-->
<li id="news_list">
<?php include 'libs/file.php';?>
</li>
//pagination links
for($i=1; $i<=$pages; $i++)
{
echo '<li id="'.$i.'"><a href="#" >'.$i.'</a></li>';
}
and the js function
//js function
//Pagination Click
$(".paging li").click(function(event){
event.preventDefault();
$("#news_list").val("");
//Loading Data
var pageNum = $(this).attr("id");
$("#news_list").load("file.php?news_page=" + pageNum);
$(this).children("a").setClass("active");
});
This is a part of a pagination script I am building. Also the following line
$(this).children("a").setClass("active");
Does not apply the class to the nested 'a' element within the selected li. Any help is appreciated.