Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

input number only

//html
<input type="number" class="form-control" @keypress="isNumberKey($event)">

//js
isNumberKey(e){
    if (e.charCode === 0 || /d/.test(String.fromCharCode(e.charCode))) {
    	return true
    } else {
    	e.preventDefault();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #input #number
ADD COMMENT
Topic
Name
9+4 =