How can I remove AutoNumeric formatting before submitting form?

后端 未结 11 2975
栀梦
栀梦 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:17

    autoNumeric("getArray") no longer works.

    unformatOnSubmit: true does not seem to work when form is submitted with Ajax using serializeArray().

    Instead use formArrayFormatted to get the equivalent serialised data of form.serializeArray()

    Just get any AutoNumeric initialised element from the form and call the method. It will serialise the entire form including non-autonumeric inputs.

    $.ajax({
        type: "POST",
        url: url,
        data: AutoNumeric.getAutoNumericElement("#anyElement").formArrayFormatted(),
    )};
    

提交回复
热议问题