Jquery get Form input Radio & Checkbox method


Today We will talk about Jquery!  Well not mention everybody know better Jquery then Javascript cause it’s more usage for most web application and animation,

The most bother us is get the value of those form input, select, Radio, checkbox part. So here might have some trick!!


  1. Get input value: $(‘input[name=”email”]).val();


2. get select value: $(‘select[name=”country”]’).val();

just remind that for select value, the type will not be a string, it will be an Array, so it should be like this : var selectValues = $(‘select[name=”autralia”]’).val() || [] ;

in this case, if the user not choice any value, the return val will be still empty Array, if not put [], will return undefined!!


3. get radio value: $(‘input:radio:checked[name=”paymentName”]’).val();

and if user has no thing to selected, the return value will be undefined!


4. get checkbox value: $(‘input:checkbox:checked[name=”saveinfo”]’).map(function() { return $(this).val();}).get();

here use the map() to get multiple value and use get()  to get data


Hope this is useful as need to get the value of all form!!

Leave a Reply

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