I use the .serialize() function to make a key -> value pair string for updating a database using an HTML form. Recently I have been wanting to omit one of the input fields from the data string. I thought that the .not() function should work, but it doesn’t (as far as the way I am using it here).. Please see the fiddle for an example of the problem. http://jsfiddle.net/9RbZ4/
In this example, there are four fields, with names a, b, c and d. I wish to omit the field with name=”a” from the serialize function. How should I do that? Please note I wish to reference the name attribute of the element.
How do I do this?
Thanks!
This does look a little odd as you would expect the not to filter out bits you don’t want.
however you are selecting the form itself rather than the inputs, this is why it cannot filter.
should do the trick.
NB – I use *[name] as you may have elements other than input involved…