Pass in select id

This commit is contained in:
Paul Sealock 2019-07-08 11:41:52 +12:00
parent bc23340909
commit 2d2ef711b8
1 changed files with 7 additions and 5 deletions

View File

@ -24,16 +24,18 @@ class WC_Coupons_Tracking {
public function tracks_coupons_bulk_actions() {
wc_enqueue_js(
"
function onApplyBulkActions() {
var action = $('select[name=\"action\"]').val();
if ( '-1' !== action ) {
function onApplyBulkActions( event ) {
var id = event.data.id;
var action = $( '#' + id ).val();
if ( action && '-1' !== action ) {
window.wcTracks.recordEvent( 'coupons_view_bulk_action', {
action: action
} );
}
}
$( '#doaction' ).on( 'click', onApplyBulkActions );
$( '#doaction2' ).on( 'click', onApplyBulkActions );
$( '#doaction' ).on( 'click', { id: 'bulk-action-selector-top' }, onApplyBulkActions );
$( '#doaction2' ).on( 'click', { id: 'bulk-action-selector-bottom' }, onApplyBulkActions );
"
);
}