Reputation: 87
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?
Upvotes: 1
Views: 1165
Reputation: 11
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");
Upvotes: 1