button onclick function firing twice
My event was firing twice because I accidentally included both my_scripts.js AND my_scripts.min.js. Ensure you only include one.
Maybe you are attaching the event twice on the same button. What you could do is unbind any previously set click events like this:
$('.addToCartButton').unbind('click').click(function() {
alert("bob");
//addToCart($(this).attr("id"));
});
This works for all attached events (mouseover, mouseout, click, ...)
Unbind event from selector and after appending in element in DOM again trigger event on specific selector.. $("selector_name").unbind( "event" ); //After this call event on selector again..
For example:
$( "#button" ).unbind( "click" );
$("#button").click(function(event) {
console.log("button click again);
});