Code to get all form element values using JQuery

By
Advertisement
In this example i am going to explain about how to get all filled values using JQuery

Steps To Follow:

1.To get all elements( textbox,checkbox,radiobutton,textarea) values inside a div with id “parentdiv” below jQuery code is used.

var outval = "";
$('#parentdiv input:checked,#parentdiv textarea,#parentdiv input[type=text]').map(function () {
    outval += this.value + ",";
}).get().join(',')
alert(outval);

2. If your parentdiv contains many divs inside it then you can use the below code to get the value.

var outval = "";
jQuery('#parentdiv > div input:checked,#parentdiv > div textarea,#parentdiv > input[type=text]').map(function () {
    outval += this.value + ",";
}).get().join(',')
alert(outval);

Do you like this article? Help us to improve. If you have any queries post it in comments.

Other articles you may like

  1. Check div/element/object is visible or hidden using Jquery - New !!
  2. Add remove select and set items in select drop down list
  3. Bind unbind event in jQuery
  4. Check uncheck all checkboxes in grid view using jquery
  5. Get current url using JavaScript jQuery
  6. How to get the keycode for different browser for keyboard characters
  7. Move items in drop down list from left to right using jQuery

0 comments:

Post a Comment

Online Casino