Hey I have a simple code with two form and two javascript. When I clicked num key 1 or 9 should be send form, and only working with last one form. If I switch javascript code and the last one will be keycode 49 (1) then numer 1 is working but num 9 not. Problem is because on the same page I had 2 separately forms
function submitForm() {
document.priceOptionForm.submit();
document.priceOptionForm.method='post';
}
document.onkeydown = function () {
if (window.event.keyCode == '49') {
submitForm();
}
}
document.getElementById("profile_price").onclick = submitForm;
function submitForm2() {
document.priceOptionForm2.submit();
document.priceOptionForm2.method='post';
}
document.onkeydown = function () {
if (window.event.keyCode == '57') {
submitForm2();
}
}
document.getElementById("profile_price2").onclick = submitForm2;
<form action="" method="post" class="priceOptionForm" name="priceOptionForm">
<input name="paypal_email" type="text" value="whatever" id="email">
</label>
<a href="javascript:void(0);" class="bluebtn" id="profile_price" style="width:60px;margin-top:5px;">Save all</a>
</form>
<form action="" method="post" class="priceOptionForm2" name="priceOptionForm2">
<input name="paypal_email" type="text" value="whatever" id="email">
</label>
<a href="javascript:void(0);" class="bluebtn" id="profile_price2" style="width:60px;margin-top:5px;">Save all</a>
</form>