当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery遍历Form示例代码

jQuery遍历Form示例代码

2018年04月19日  | 移动技术网IT编程  | 我要评论
jQuery 遍历 Form,代码如下 . 代码如下: <script type="text/javascript"> // 取得 i

jQuery 遍历 Form,代码如下

. 代码如下:


<script type="text/javascript">

// 取得 id 为form1 的 form 的所有输入变量

values = $("#form1").serializeArray();

var values, index;

for (index = 0; index < values.length; ++index)
{
if (values[index].name == "textfield2")
{
// 改变 form 中指定 input 的值
values[index].value = "hello";
}
}

</script>

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网