jQuery UI Widgets › Forums › Editors › MaskedInput › Retrieving the masked input's value without the mask
Tagged: jqxmaskedinput, partial value, value
This topic contains 5 replies, has 4 voices, and was last updated by Peter Stoev 5 years ago.
-
Author
-
Greetings,
I have a few masked inputs for phone numbers using the mask “## ## ## ## ##” (french way of displaying phone numbers).
I would like to retrieve the value of the input without the mask. For instance, if my input shows “03 8_ __ __ __”, I would like to get either “03 8” or “038”.
What’s the best way to approach this ? Am I supposed to use
$('#phoneNumber').jqxMaskedInput('inputValue');
(which returns038_______
) and then remove the remaining_
, or is there a better way to do this ?Seems odd there doesn’t seem to be a proper way to do this since you can set the value property without the
_
when creating the masked input (i.e.value:"038"
).Thanks in advance,
Coloco
Hi Coloco,
You are using the only possible way to extract partial values.
Until now we are not included built-in function for that feature.Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.comAn update with this topic?
Hi SysProfile,
You can easily replace the mask characters: $(“#jqxMaskedInput”).val().replace(/-|_/ig, ”)
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
My English is the product of using Google Translate, I hope you can understand the following text
Ok, that’s what I’m doing, but if there is an additional function ?, for example valNoMask(). All that developers can avoid the direct use of program functions in javascript, make it more powerful components.
I do not know if it makes any difference, but I bought the product developer license for multiple sites.
- This reply was modified 5 years ago by SysProfile.
Hi SysProfile,
Thanks for the suggestion.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.