/ / Page load
jQuery (document) .ready (function ($) {
var loading=false
$("div-sharppost-read-more a").click( function() {
if(loading)return
loading=true
$this = $(this);
$this.removeClass().addClass("loading"); //aloadingclass
var href = $this.attr("href"); //
if (href != undefined) { //
$.ajax( { //ajax
url: href, //
type: "get", //get
error: function(request) {
loading=false
},
success: function(data) { //
loading=false
$this.removeClass("loading"); //loading
var $res = $(data).find(".list"); //
$(".box").append($res); //posts-loop
var newhref = $(data).find("-sharppost-read-more a").attr("href"); //
if( newhref != undefined ){
$("-sharppost-read-more a").attr("href",newhref);
}else{
$("-sharppost-read-more a").html("").removeAttr("href");
}
}
});
}
return false;
});
});
that is, when I click to load more, I want to delete the style of the button and then directly adopt the style of loading.,. RemoveClass () seems to be invalid and doesn"t work.
that is, when you click to load more, the new button style of loading will be displayed directly. How to do it?