Get all Form Values in JS Object via jQuery

Let’s consider a long form with 20 or 30 fields. There are times when you want to consume the data of such form directly as name => value pairs as an object to either send it via Ajax or manipulate data in jQuery and so on. There is a neat little trick to achieve the same. Below is a small snippet which gets all the form values and converts it into a JavaScript Object using jQuery

JS Snippet

JSFiddle

Tags:,

Add a Comment

Your email address will not be published. Required fields are marked *