zoukankan      html  css  js  c++  java
  • jquery为某div下的所有textbox的赋值

    html代码

    <input type="button" value="变量div_Alltext中的变量" onclick="Do_DivAllTxt()"/>

    <div id="div_alltext" style="background-color:#FCC">
    <input type="text" name ="txtx"/>
    <input type="text" name ="txtx"/>
    <input type="text" name ="txtx"/>
    <input type="text" name ="txtx"/>
    <input type="text" name ="txtx"/>
     </div>

    js代码

    function Do_DivAllTxt()
    {
     var alltxt = $("#div_alltext input[name=txtx]"); //关键点,通过表单属性input[name=txtx]; ,找到div下的txtbox
     $.each(alltxt,function(i){
           $(this).val("ok");
             });
     }

  • 相关阅读:
    MCU开发之I2C通信
    hibernate特殊的映射
    Hibernate使用
    css设置让a标签充满整个li
    margin
    border属性
    列表
    链接样式
    相机内参外参
    tmux
  • 原文地址:https://www.cnblogs.com/Ellfelo/p/jquery.html
Copyright © 2011-2022 走看看