问题
I want to prepend +90 (Turkey's phone code) to every phone numbers a user enters. For that reason I am using a mask like this:
<p:inputMask
id="homePhone"
value="#{personController.model.homePhone}"
mask="+90 (999) 999-9999"
size="20"
converter="converterPhone" />
But displays it like this: +_0 (___) ___-____
However, I want it to look like this: +90 (___) ___-____
<!-- pay attention to 9 -->
Is there a way to escape the first 9
like this: mask="+\90 (999) 999-9999"
?
Thank you all...
回答1:
Number 9 is used as mask for all the digits, if you want to use 9, change the mask using JavaScript, by redefining x as mask :
$.mask.definitions['9'] = '';
$.mask.definitions['x'] = '[0-9]';
Now you can use x as mask, :
<p:inputMask mask="+90(xxx) xxx-xxxx" id="homePhone" />
来源:https://stackoverflow.com/questions/39913451/escape-number-9-in-pinputmask