如何使用jquery获取多个文本框的值... textbox没有id [英] how to get value of multiple textboxes using jquery ...textbox doesn't have id

查看:91
本文介绍了如何使用jquery获取多个文本框的值... textbox没有id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有100个文本框,并且没有文本框的ID ...那么我将如何获得特定文本框的值....请让我明白该做什么......



提前感谢

i have 100 textboxes and there is no id of the textbox...then how will i get the value of the particular textbox....please make me clear what to do......

thanks in advance

推荐答案



您可以通过两种方式完成此操作。

首先,如果你有div中的所有文本框,那么你可以使用像这样的子函数获得所有文本框值,

Hi,
You can do this in two way.
First if you have all the textbox in a div then you get all the textbox value using children function like this,
function GetTextBoxValueOne() {


#divAllTextBox)。children( input:text)。 ( function (){
alert(
("#divAllTextBox").children("input:text").each(function () { alert(


this )。val());
});
}
(this).val()); }); }



这里我们通过父div div得到所有文本框的值。



现在另一种方法是你可以为你需要的那些文本框提供一个类名,并使用这样的类名来获得该控件,


Here we get all the textbox's value by its parents div Id.

Now another way is you can give a class name to those textboxes which value you need and get that control with class name like this,

function GetTextBoxValueTwo() {


这篇关于如何使用jquery获取多个文本框的值... textbox没有id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆