Magento – Magento 2: How to use event trigger on the checkout page

checkoutdrop-downsevent-observerjquerymagento2

How to use event trigger when change "State/Province " drop-down on the checkout page?

I'm trying to page reload when user change Region from "State/Province" dropdown in the checkout page.

First, I've created js file and put code and this js add in frontend using article but it's not worked

also, I have put static JS file in XML file but there give a JQuery not defined error.
see below js file code

define([
   "jquery",
],
function($) {
   "use strict";
    $('document').on('change', 'select[name="region_id"]', function(){
       alert("hi");
    });
return;
});

Best Answer

put an alert('test'); in your js file or check in debugger tool whether your js is getting called or not, if it gets called then use this in you file:

jQuery('document').on('change', '**identifier-of-the-field**', function(){
   //opertation to be performed
});
Related Topic