Answer the question
In order to leave comments, you need to log in
How to make clicking on the a tag when submitting the form by pressing enter?
There is a form. The submit button has an onclick event and a link that reloads the page. It is necessary that after filling out the form and pressing Enter - the submit event - there is a click on the link in the Submit button to reload the page.
I write like this:
function ClearCart(element) {
var href = element.href;
if (href)
$.get(href, function(data){
$("cart").html('');
BX.onCustomEvent('OnBasketChange');
location.reload(true);
});
return false;
}
document.getElementById('ocf-submit').on("submit", function(e) {
e.preventDefault();
document.getElementById('btn-ocf-submit').onclick = ClearCart();
});
Answer the question
In order to leave comments, you need to log in
document.getElementById('ocf-submit').on("submit", function(e) {
e.preventDefault();
ClearCart(document.getElementById('btn-ocf-submit'));
});
document.getElementById('ocf-submit').addEventListener("submit", function(e) {
e.preventDefault();
ClearCart(document.getElementById('btn-ocf-submit'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question