$('.push').each(function(){
if($(':first-child',this).hasClass("activex")){
$(this).off().off('click').on('click',function(){
var a = $(this).attr('id');
$.ajax({
type: "POST",
url: "includes/rcart.php",
data:{'pid': a},
success: function(data){
var a= parseInt($('.cart').text());
if((data.indexOf("2")) >= 0){
console.log(data);
console.log('not removed');
}else{
a--;
console.log('removed');
$(this).children().removeClass('activex');
$('.cart').text(a);
}
}
});
console.log(a);
});
}else{
$(this).on('click',function(){
var a = $(this).attr('id');
$.ajax({
type: "POST",
url: "includes/cart.php",
data:{'pid': a},
success: function(data){
console.log(data);
var a= parseInt($('.cart').text());
if((data.indexOf("2")) >= 0){
console.log('done');
}else{
a++;
$('.cart').text(a);
$(this).children().addClass('activex');
}
}
});
console.log(a);
});
}
});
작동하지 않습니다 클래스. 클래스 .push가있는 크롬 콘솔에서 클래스를 수동으로 제거하면 작동합니다.JQuery와 addClass(), removeClass() 함수는 클래스 푸시 버튼이 클릭 될 때마다 나는 클래스 액티브을 제거하기 위해 노력하고 있지만이 작동하지 및 오류 코드에 없다 그것을 제거 아니에요
클래스 푸시 버튼이 클릭 되었으나 작동하지 않고 코드에 오류가없고 클래스를 제거하지 않을 때마다 클래스 activex를 제거하려고합니다. 클래스 .push가있는 크롬 콘솔에서 클래스를 수동으로 제거하면 작동합니다.
'$ (이) .children()는 removeClass ('액티브'). HTML을 공유하세요 '등의 –
에 대한 동일,''$ (이) .removeClass ('액티브 ') 할 필요가 – brk
버튼에 대한 Heres html 페이지에 많은 버튼이 있습니다 –