I want to apply mask to an input element when it receives focus with jquery.maskedinput plugin. But the first time it gets focus, the mask is not there. Only when it receives focus the second time, the mask shows up. How can I make the mask to show the first time it gets focus?
html:
<input type=text id=a />
<input type=text id=b />
script:
$(document).ready(function () {
$('#a').on('focus', function () {
$(this).mask('999');
});
});