Home > JQuery > Get Form all field value at a time by JQUERY.

Get Form all field value at a time by JQUERY.

You can get form all data at a time by clicking any field.Only jquery serializeArray function can do this. Here is very important thing is all field class name must be same, Below example all field class name is “Target”,


jQuery(document).ready(function () {

jQuery(‘.target’).change(function() {

var formAllData;
var fieldName;
var fieldValue;
var grossTotal=0;

formAllData = $(‘#getAllData’).serializeArray();

var dataArray = new Object();

for( index in formAllData)

if(formAllData[index].value) {
//dataArray[perfTimes[index].name] = perfTimes[index].value;

fieldName =formAllData[index].name;
fieldValue = formAllData[index].value;

grossTotal += parseInt(fieldValue);


var pre_gross_price = jQuery(“#priceGross”).val(grossTotal);


<form name=”getAllData” id=”getAllData” action=”#”>

<input type=”text” name=”priceGross” id=”priceGross”  value=”1000″ />

<input type=”checkbox” name=”Attribute1″ id=”Attribute1″ value=”600″  />
<input type=”checkbox” name=”Attribute2″ id=”Attribute1″ value=”600″ />
<input type=”checkbox” name=”Attribute3″ id=”Attribute1″ value=”600″  />

<input type=”radio” name=”Size” id=”Size” value=”300″ /> XL
<input type=”radio” name=”Size” id=”Size” value=”500″ /> XXL

<select name=”color” id=”color”>
<option value=”100″>Red</option>
<option value=”200″>Blue</option>
<option value=”300″>Green</option>


Categories: JQuery
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: