jquery-inputmask

How to get unmask value in MVC controller

妖精的绣舞 提交于 2019-12-04 13:13:09
I am using jquery.inputmask.js in my project as $("#SSN").inputmask({ "mask": "999-99-9999", 'autoUnmask': true, onUnMask: function (value) { return value.replace('-', ''); } }); It works fine when displaying. But when i post this model and read the values in controller, it is still giving 999-99-9999 instead of 999999999. I don't want to read each value and replace them as Model.SSN.Replace('-','') before saving. Please help. Thanks!!!! EDIT: When i read $("#SSN").val() in jquery it is returning 999999999 format, but not in controller(c#). hhk Try doing this before submitting your form: $("