开发者

jquery mask output

开发者 https://www.devze.com 2023-01-27 17:59 出处:网络
I have a jquery masked textbox which has a mask: $(\"#txthtml\").mask(\"99/99/9999\"); When I check the output, it has the \'/\' in its value. Is there an easy way to get only what the user entered

I have a jquery masked textbox which has a mask:

$("#txthtml").mask("99/99/9999");

When I check the output, it has the '/' in its value. Is there an easy way to get only what the user entered and nothing else? So if text box read 01/01/1990 I want 01011开发者_如何转开发990 .

Same thing if I have a phone number mask, how can I get the user input only?


JavaScript can replace the / characters with an empty string: yourDateString.replace(/\//g, "")


Use a regexp to strip the '/' characters, or do split/join:

"01/01/1990".split("/").join("");
0

精彩评论

暂无评论...
验证码 换一张
取 消