i have a custom form.html that displays at checkout. i want to have a javascript tag - when the form load just show an alert testing purposes.
code i used below,
"<script type="text/javascript">
require(['jquery', 'jquery/ui'], function($){
$('document').ready(function(){
console.log("this")
alert('Load');
document.getElementById('pinverify').style.display = "none";
document.getElementById('labelBalance').style.display = "none";
document.getElementById('payment[custom_field_one]').value ="";
document.getElementById('OTP').value= "";
document.getElementById('payment[custom_field_three]').value = "";
$('#verify').click(function(){
checkOTPField();
});
"
but this alias does not work, is there a different alias used in magento 2?
Thank you
-
Can you give the path to this .html file.Sourabh Kumar Sharma– Sourabh Kumar Sharma2018年09月26日 13:51:39 +00:00Commented Sep 26, 2018 at 13:51
-
[namespace]/[ModuleName]/view/frontend/web/template/payment/form.htmlRadhiyah Williams– Radhiyah Williams2018年09月26日 13:54:03 +00:00Commented Sep 26, 2018 at 13:54
-
Can you describe your purpose?Dhiren Vasoya– Dhiren Vasoya2018年09月26日 14:15:54 +00:00Commented Sep 26, 2018 at 14:15
-
i have created a custom form i have a textbox on the form aswell as a button i would like to run the javscript for that button within the html form $(button).click function - but its not allowing me to do thatRadhiyah Williams– Radhiyah Williams2018年09月26日 14:47:53 +00:00Commented Sep 26, 2018 at 14:47
-
Hey have you override this from (web/template/payment/form.html) from any core module? @RadhiyahWilliamsRutvee Sojitra– Rutvee Sojitra2018年09月27日 06:54:18 +00:00Commented Sep 27, 2018 at 6:54
1 Answer 1
Assuming that you checked and do not have any error in your js code. Possible reason for the changes to not reflect is that you did not run the content:deploy command after making the changes:
Please run the below commands:
bin/magento cache:clean
bin/magento setup:static-content:deploy
Explore related questions
See similar questions with these tags.