Car Mask in jQuery

2

I did not find on the internet a mask in the format BBB-1234 for car signs, the ones I found only validate when the field loses focus and even then only say if it is valid or invalid .

You would need something in the first 3 characters to accept letters, add the dash, and, in the next 4 characters, only accept numbers.

    
asked by anonymous 01.09.2017 / 17:03

1 answer

4

You can use the RobinHerbots inputmask plugin in addition to jquery add the jquery.inputmask.bundle.js file.

The mask code is composed of three letters (% w / o%) one stroke (% w / o%) and four digits (% w / o%)

javascript:

$(document).ready(function(){
   $("#placa").inputmask({mask: 'AAA-9999'});
});

html:

<input type="text" id="placa" >

Example - jsfiddle

Relationships:

Phone Mask Using jQuery Mask Plugin

Digitalbush Plugin for CNPJ and CPF masks in the same field

    
01.09.2017 / 17:13