views:

74

answers:

2

Hi

I have a list of textboxes created dynamically accroding to the user selection on aspx page.

I want to get and store into an array the value of these using Jquery, javascript.

how can i do that?

is it possible to loop through all the textboxes in a page?

Thanks

+1  A: 

You can use map to succinctly grab all the values:

var values = $("input[type=text]").map(function() {
    return this.value; // or $(this).val()
}).get();

Loop over all textboxes using each:

var values = [];
$("input[type=text]").each(function() {
    values.push(this.value);
});
karim79
A: 
var values = new Array();
$(":text").each(function(){
    values.push ( this.value );
});
rahul