I have four buttons which either increment a variable by 1
<button type="button" class="btn btn-outline-dark" onclick="decrementY()"><span class="icon-arrow-up"></span></button>
<button type="button" class="btn btn-outline-dark" onclick="incrementX()"><span class="icon-arrow-right"></span></button>
<button type="button" class="btn btn-outline-dark" onclick="incrementY()"><span class="icon-arrow-down"></span></button>
<button type="button" class="btn btn-outline-dark" onclick="decrementX()"><span class="icon-arrow-left"></span></button>
So when the button is pressed, either the x or y value should be effected, the up and down arrowss workfine, but when I click the left/.right arrows I get
Here are the 4 functions
function incrementX() {
document.getElementById("x_coord").stepUp(1);
document.forms["Positions"].submit();
}
function decrementX() {
document.getElementById("x_coord").stepDown(1);
document.forms["Positions"].submit();
}
function incrementY() {
document.getElementById("y_coord").stepUp(1);
document.forms["Positions"].submit();
}
function decrementY() {
document.getElementById("y_coord").stepDown(1);
document.forms["Positions"].submit();
}
They all seem similar, so why the error?
Got it, my form element had 2 ids…