Zend certified PHP/Magento developer

Inject external JS that handle the address autocomplete

I am new to Magento, i would like to create a Magento 2 extension that enable the address autocomplete feature.

I’ve created a JS using internal wizard that mapped from using Magento Checkout form fields. The generated JS basically is expected to handle the address autocomplete when i enter some text in the stress address text field based on the selected country. I do not need register or handle the listener by myself, is all handle in the JS. I have tested another generated JS using a simple form, is working fine, however it doesn’t work when applied into the magento extension.

I tried to add the following into the view/frontend/template/onepage.phtml.

I inspected the webpage, it managed to load the JS and the dependencies JS when the checkout page is loaded. However, there is no response when i enter text in the stress address text field.
I’ve checked from google, it seems like i need to use “Observer” to handle the events. Anyone knows is there a simple way to do that?

Kindly advise.

Thanks in advance