javascriptjqueryjquery-mask

jQuery Mask removes the input value after wrong character pressed


When you type for example 1a or 22, the input value content disappear. I want to something like this: http://jsfiddle.net/b4t34zu5/29/ I mean after wrong character contnet not disappear.

$('#x').mask('ZZZDZZ', {				
		translation: {
			'Z': {pattern: /[\d]/, optional: true },
			'D': {pattern: /[\.]/, optional: true },
        
		},
		placeholder: "XXX.XX",
		selectOnFocus: true,
		reverse: true,
		clearIfNotMatch: true
			
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.9/jquery.mask.min.js"></script>

<input type="text" id="x" value="" />


Solution

  • Finally, I have got it:

    $('#input').mask('099.00');