When to use .on()

When you add elements to the dom, and then want click handlers on them, you have to add it to a dom element that was already there on page load.

$('.product-description').on('click', '.toggle-shipping', function(e) {
e.preventDefault();
$(this).closest('.shipping-origin').find('.content').slideToggle();
$(this).closest('.shipping-origin').toggleClass('active');
});

Since shipping origin and the toggle-shipping link was added after the fact in jQuery, you have to basically call the js .on() handler. Meaning that it’s going to watch the product-description for any .toggle-shipping element added to it and then run that click event.