Month: September 2016

Limiting input tag to numbers without using html 5 type=”number”

The reason for this post is due to the fact that not all major browsers support HTML input types yet.

 

This example limits the input to numbers.

<input onkeypress=’return event.charCode >= 48 && event.charCode<=57′>

 

This example limits the input to numbers, but, decimal works.

<input onkeypress=’return (event.charCode >= 48 && event.charCode<=57) || event.charCode==46′ >