How can I remove AutoNumeric formatting before submitting form?

后端 未结 11 3015
栀梦
栀梦 2021-02-19 05:26

I\'m using the jQuery plugin AutoNumeric but when I submit a form, I can\'t remove the formatting on the fields before POST.

I tried to use $(\'input\

11条回答
  •  深忆病人
    2021-02-19 06:19

    There is another solution for integration which doesn't interfere with your client-side validation nor causes the flash of unformatted text before submission:

    var input = $(selector);
    var proxy = document.createElement('input');
    proxy.type = 'text';
    input.parent().prepend(proxy);
    proxy = $(proxy);
    proxy.autoNumeric('init', options);
    proxy.autoNumeric('set', input.val())''
    proxy.change(function () {
        input.val(proxy.autoNumeric('get'));
    });
    

提交回复
热议问题