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();
精彩评论