Magento – detect onchange event of country dropdown

cartjavascriptmagento-1.9selectshipping

I am using select2 jQuery plugin to make Magento HTML select nicer. The plugin replaces the actual select with a set of tag which replicate the functionalities of the select. Doing in this way I am missing some default beahviour of Magento select, such as the switch between dropdowns countries and address input field when United States are selected.

Anyone knows where this functionalities are inside Magento js scripts?

Best Answer

Code you are looking for is in js/varien/form.js file. Look for RegionUpdater = Class.create(); line, inside initialize function, you are probably interested in following line:

Event.observe(this.countryEl, 'change', this.update.bind(this));
Related Topic