How to restrict input box to only accept postive numbers and have a maxium value of 10

Im trying to only use javascript to accept positive numbers in the input field

I’ve tried to use this, but don’t know how to set a max value of 10.

if (Number.isInteger(num) && num >= 0) {


Try this:

if (Number.isInteger(num) && num >= 0 && num <= 10) {

You can also do the min/max attribute thing mentioned in the comments, although do be warned that that has different implementations per browser and isn’t supported on IE 9 and below.