Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

date masking javascript to not allow /


onkeyPress ="
<input
    type="text"
    name="date"
    placeholder="mm/dd/yyyy"
    onkeyup="
        var v = this.value;
        if (v.match(/^d{2}$/) !== null) {
            this.value = v + '/';
        } else if (v.match(/^d{2}/d{2}$/) !== null) {
            this.value = v + '/';
        }"
    maxlength="10"
}"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #date #masking #javascript
ADD COMMENT
Topic
Name
7+9 =