I'm trying to disable click on the button on the page before the page fully loads. I've tried the code below, which should active the click for a particular element when the page is loaded:
<script>
$(document).ready(function() {
$("div#wc-proceed-to-checkout").click(function () {
launchAction();
});
});
</script>
Alternative solution - disable click for the whole page until the page fully loads.
CodePudding user response:
You can try using the disabled attribute on button to disable it.
https://www.w3schools.com/tags/att_button_disabled.asp
and once the page loads remove the attribute
using - removeAttr('disabled') method
CodePudding user response:
Your script:
<script>
$(document).ready(function() {
$("div#wc-proceed-to-checkout").disable(false);
$("div#wc-proceed-to-checkout").click(function ()
{
launchAction();
});
});
</script>
The HTML element must have disable true, or you can
<script> document.getElementById("wc-proceed-to-checkout").disable = true;
</script>