开发者

Need help combining jquery serialize with not or filter

I'm trying to serialize a form and exclude certain elements. but nothing is working. here are some examples.

$.post("process.php", $("#featured-form").filter("select").serialize(), function(res) {
$.post("process.php", $("#featured-form").filter(".exclude").serialize(), function(res) {

do开发者_Python百科es anyone have any ideas??


First, filter() filters out the elements that don't match the specified selector. Since you seem to want the opposite behavior, you probably should use not() instead.

Then, you have to select the form elements in order to filter them, not the form itself. The following should do what you want:

$("#featured-form :input").not("select, .exclude").serialize();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜