JS - Only numeric allowed and limit character on input

0 votes
added Jun 19, 2018 in Javascript by LC Marshal Captain (25,790 points)
edited Jul 13, 2018 by LC Marshal
<input id="contact" maxlength="12" name="phone-number" id="phone" value="<?php echo $myeq["userphone"]; ?>" class="valid-empty valid-phone" data-err-msg="Phone cannot be empty." data-invalid-msg="Invalid phone number, please use number only." onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.