开发者

Get values of textboxes created dynamically

I have a list of textboxes created dynamically accroding to th开发者_运维技巧e 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


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);
});


var values = new Array();
$(":text").each(function(){
    values.push ( this.value );
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜