Answer the question
In order to leave comments, you need to log in
Why don't .remove and .removeClass work?
Hello!
Faced the following problem
. There is a count variable, which is responsible for the number of items in the cart.
If count == 0, then with the help of .append the "Take All" button is displayed, if count =! 0, the "Delete All" button is displayed:
$(".item").click(function(){ // при клике на товар
if(count == 0){
$('.buttondiv').html(''); // очищаем блок buttondiv
$('.buttondiv').append('<span id="add">Take All</span>'); // добавляем в него спан "Забрать все"
}
if(count != 0){
$('.buttondiv').html(''); // очищаем блок buttondiv
$('.buttondiv').append('<span id="remove">Clear</span>'); // добавляем в него спан "Удалить все"
}
});
$("#remove").click(function(){
// код //
console.log('Удалено'); // пример
});
$("#add").click(function(){
// код //
console.log('Добавлено'); // пример
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question