0

Like the title says I need some help combining two jQuery functions. It seem's pretty simple but I can't figure it out. They each do the same thing. If it helps, the second function's 'updated_checkout' is a WooCommerce callback.

$( window ).on( 'resize', function () {
     // Do same thing as other function
});

jQuery( document ).on( 'updated_checkout', function () {
     // Do same thing as other function
} );
J. Cannor
  • 163
  • 1
  • 2
  • 9

1 Answers1

3

Simple as:

function doTheSameThing() {
    // Do same thing
}

$( window ).on( 'resize', doTheSameThing);

jQuery( document ).on( 'updated_checkout', doTheSameThing);
Kristianmitk
  • 4,528
  • 5
  • 26
  • 46