Create and trigger a custom jquery event

If you want to reuse a function called showMaterial that both are used to show individual teddybears materials but now is going to be used for showing all teddybears materials, creating a custom event and then trigger it is a great way to do it.

var showMaterial = function() {....};
$('.teddybear').on('show.material', showMeterial);
$('.buttonclass'.on('click', function(event){

Add your comment