Excluding certain inputs on serialize

前端 未结 6 1171
长发绾君心
长发绾君心 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:32

    You don't need the :, because input is an element not a pseudo selector. Secondly you cannot use an object and a text string like that in your selector. You instead need to supply this as the scope argument to $():

    $('#ofform').live('submit', function(e) {
        e.preventDefault();
        var serializedReturn = $('input[name!=security]', this).serialize();        
    });
    

提交回复
热议问题