So, I'm trying to hit the button after a form is filled in. I have this currently:
document.getElementById("checkout_shipping_address_country").dispatchEvent(event);
document.getElementById("checkout_shipping_address_phone").value = userInfo.tel;
if ($("#checkout_shipping_address_province").length != 0) {
document.getElementById("checkout_shipping_address_province").value = userInfo.state;
$("input[name='commit']")[0].click();
}
It is an ajax form so it reloads after every click, in this case it seems like it's repeating the click, how can I only have it run once?
You can disable the button with jquery by adding,
$('#button_id').attr("disabled", true);
to enable the button again you can use
$('#button_id').removeAttr("disabled");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.