/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('#myForm').submit(function() { // get all the inputs into an array. var $inputs = $('#myForm input, #myForm textarea, #myForm select'); // not sure if you wanted this, but I thought I'd add it. // get an associative array of just the values. var values = {}; $inputs.each(function(i, el) { values[el.name] = $(el).val(); }); });
Comments
