The correct syntax would be onclick=”onsubmit()” I believe unless you’re using some kind of framework
Solution 1 :
Problem :
I can’t figure out why this button will not work on mobile. I’ve tried a few different things but can’t seem to get it tow work. Everything is fine on desktop but not on mobile (google inspect or actual iPhone). Using WordPress.
// Starts the sequence from the GO button
function onSubmit() {
inputHandler();
findItem(input)
}
<button class="barItem" style="width: 40px" id="submit" onclick={onSubmit()}>GO</button>
Also Tried this
// Starts the sequence from the GO button
function onSubmit() {
inputHandler();
findItem(input);
}
// Starts the sequence when you press enter
document.getElementById('pNum').onkeydown = function(e) {
if (e.keyCode == 13) {
onSubmit();
}
};
<input class="barItem" type="submit" onclick={onSubmit()} onsubmit={onSubmit()} value="GO" />
Comments
Comment posted by jwatts1980
Try using quotes on your onclick
Comment posted by 1252748
Is the