Checking for numeric input only and get the value

Hi,
I have an input field -
input id=“answer” style=“width: 100%; height: 100%;” type=“text”

and a submit button
button type=“button”> Submit</button

How do I check for numeric input only on the “answer” input? It can be as they press the keys or when they click the submit button.

Also how do I get the value entered in the “answer” field?

I’ve setup JS function and set the submit button click to run the function

onSubmitClicked(doc, e) {
// is the answer numeric only?

// if passed get the value of answer here
}

Thanks!

Ok after some trial and error I got something working. Thanks anyway!

1 Like