this question has already been asked but the solutions where not clear.
Im using Josh Bush\'s MaskedInput plugin for jQuery
What im trying to achieve is:
If you are using the completed callback, then you can just use:
$(element).mask("(99)9999-9999", {
completed : function () {
var numbers = this.val().replace(/()-/g,'');
}
}
Otherwise, you can use:
$(element).val().replace(/()-/g,'');
If you want to do this before submitting, I suggesting capturing the submit event, using the code immediately above and then submitting the form.
EDIT: Alex Peattie pointed out the unmask() function, which I must say is a much better solution than mine. I'll leave my answer here, but I'd go with his solution.