I have an input box:
<input class="longboxsmall" type="text" name="number" value=""/>
And I want to disallow the number 0 being the first number entered in the box how can I do this??? Can I use Jquery??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JS
HTML
Try in jsfiddle.
IT’s good to intercept another events, like blur, change, focusout, etc.
See jquery.
Tks @Simen Echholt.
Explanation:
$(".longboxsmall").keyupJquery take every element with class
longboxsmalland are ready to call a function on onkeyup event.This function uses a regex to replace every
0in begin (^) of value.