Javascript examples for DOM HTML Element:Input Number
Using "min" attribute with input type "tel"
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <input type="number" data-min="1" id="maskBarToMile" onkeyup="validate_phone(this)"> <script> function validate_phone(element) {//from w ww . j a v a 2 s . co m var min = element.getAttribute('data-min'); if (element.value.length<min) {console.log('value is not acceptable');} } </script> </body> </html>