VoodooChild
VoodooChild

Reputation: 9784

jquery mask output

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 01011990 .

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

Upvotes: 0

Views: 1027

Answers (2)

Jeff
Jeff

Reputation: 21892

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

Upvotes: 2

David Tang
David Tang

Reputation: 93684

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

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

Upvotes: 0

Related Questions