I want to get input text value in checkout page.
I have tried to apply jquery in checkout page but it didn’t work it. I have also worked with pure javascript but it also didn’t work.
Jquery not working because checkout page working only knockout js
<script type="text/javascript">
require([ 'jquery', 'jquery/ui'], function($){
jQuery(window).load(function(){
jQuery("#shipping-new-address-form input[name='vat_id']").keyup(function(e) {
alert("test");
});
});
});
</script>
This code is working fine on console.
Please help me and solve this issue
Thanks in advance.
2
Answers
Magento 2 works with requireJS library, so you need to use “require”/”define” function to receive the jquery.
I think that you want to change the shipping behavior, so, you can do a fallback of shipping.js from Magento_Checkout module and add your code there.
Hi please try the below code and it should work as i am already using something like this and it is working fine.