欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

jquery遍历form元素 form 子元素

jQuery 遍历 Form,代码如下

 

[javascript] view plain copy
  1. <script type="text/javascript">  
  2.   
  3.   // 取得 id 为form1 的 form 的所有输入变量  
  4.   
  5.   values = $("#form1").serializeArray();  
  6.   
  7.   var values, index;  
  8.   
  9.      for (index = 0; index < values.length; ++index)  
  10.     {  
  11.       if (values[index].name == "textfield2")  
  12.       {  
  13.         // 改变 form 中指定 input 的值  
  14.         values[index].value = "hello";  
  15.       }  
  16.     }  
  17.   
  18. </script>  


 
来自  http://blog.csdn.net/joyous/article/details/10990911
普通分类: