Hey guys, I have a little button functionality that is not erring, but also not working. The addItem gets called fine, and switches the class from "add-button" to "in-cart-button", but the $("a.in-cart-button").click(... doesn't seem to be firing. When I click the "in-cart-button", instead it triggers the addItem function again... Any ideas?
function addItem(t_id) {
$("#" + t_id).addClass("in-cart-button").removeClass("add-button");
}
function removeItem(t_id) {
$("#" + t_id).addClass("add-button").removeClass("in-cart-button");
alert("Remove item with id: " + t_id);
}
$("a.add-button").click(function(event) {
event.preventDefault();
addItem(event.target.id);
});
$("a.in-cart-button").click(function(event) {
event.preventDefault();
removeItem(event.target.id);
});
Thanks!