Detect which tag is being selected

Asked

Viewed 26 times

0

Hello! I have a jquery function that is triggered by two tags ("select" and "input") as in the code below:

$('.checkout-wrapper').on('blur', '.woocommerce-shipping-fields input, .woocommerce-shipping-fields select', function () {

});

It’s like I know which of these tags is calling the event through this or some jquery function?

1 answer

1


There is a solution to this with THIS yes.

Would look like this:

var tagName;
$('.checkout-wrapper').on('blur', '.woocommerce-shipping-fields input, .woocommerce-shipping-fields select', function () {
    tagName = $(this).prop("tagName");
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.