Excluding certain inputs on serialize

前端 未结 6 1169
长发绾君心
长发绾君心 2020-12-29 20:05

I am trying to exclude an input by name (it is a hidden input holding my nonce)

The following question is almost what I am looking for:

How do I use jQuery&#

6条回答
  •  灰色年华
    2020-12-29 20:40

    Solved ! You should use the given solution to exclude input field to be serialized. It's tested and solved my problem.

    var formdata = $($("#myform")[0].elements).not("#field_id").serialize();
    

    for multiple fields, you can use the class name to exclude them.

    var formdata = $($("#myform")[0].elements).not(".class_name").serialize();
    

提交回复
热议问题