Totally Zenned
- Join Date:
- Aug 2014
- Location:
- Lisbon
- Posts:
- 597
- Plugin Contributions:
- 0
Checkout_payement : $('.paymentSubmit').attr('disabled', true) - shouldn' be the ID ?
Hi
I had to change the relate main_jscript chechout_payment page, to load on the footer, since I have jquery at the footer.
So I was using inside the $(document).ready, the <?php if ($current_page == 'checkout_payment') { ?>
and all the code that uses jquery from chechout_payment (modules/page) was in there.
But Looking at page speed in google, and all that webmaster slavery, I see now that I have to use some "defer" to load the page content faster.
Anyway, as I was looking at the code again, I think I've spoted something ( or not ) :
$('.paymentSubmit').attr('disabled', true);
I don't see any class in tpl_checkout_payment_default.php ( the default file ) .
Shouldn't this be targeting the ID instead of the class ?
Another question, that maybe you can help me:
I'm using a gulp file that compacts all the jquery to one file. So the $(document).ready is the last file to include.
But at this piece on code ( the above one ) , there's a
<?php if ($flagOnSubmit) { ?>
$(document).ready(function(){
$('form[name="checkout_payment"]').submit(function() {
$('.paymentSubmit').attr('disabled', true);
<?php if ($flagOnSubmit) { ?>
formPassed = check_form();
if (formPassed == false) {
$('.paymentSubmit').attr('disabled', false);
}
return formPassed;
<?php } ?>
});
});
How can I detect the $flagOnSubmit in a "javascript way" , so I dont' need the php tag, and I can include all this stuff safely at the end of the y last include js file ?
ok
Thanks
“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison