0

我有这个包含此表“产品”的 Html 表单,我需要一旦用户填写所有记录中的数量字段,用户按下按钮开始扫描表并为获得的每个值执行操作。这是可能的还是我要求太多了?

    <div class="Products" >
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <thead>
    <tr>
     <th class="left">Product</th>
     <th>Quantity</th>
     <th>Precio</th>
     <th></th>
     </tr>
    </thead>
    <tbody>

    <tr>
    <td class="left">Product 1</a></td>
    <td><input type="number" name="f_qty" min="1" max="9999" step="1" value="1"></td>
   <td>35.17</td>
    </tr>
    <tr>
     <td class="left">Product 2</a></td>
    <td>
    <input type="number" name="f_qty" min="1" max="9999" step="1" value="1">
    </td>
    <td>18.48</td>
    </tr>
    <tr>
   <td class="left">Product 3</a></td>
   <td>
   <input type="number" name="f_qty" min="1" max="9999" step="1" value="1">
   </td>
   <td>4.00</td>
   </tr>
    <tr>
    <td class="left">Product 4</a></td>
    <td>
    <input type="number" name="f_qty" min="1" max="9999" step="1" value="1">
    </td>
    <td>14.20</td>
    </tr>
    </tbody>
    </table>
    </div>

你好。我已经尝试过了,但没有发生任何事情,我的顶点字段上没有显示 te 值

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"                 "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>jQuery Agregar Unidades</title>
    <script type="text/javascript">
    $("#someButton").click(
      function(){
        $("input[name=f_qty]").each(function(){
           var valueInCurrentTextBox = $(this).val(); //take action here
           valueInCurrentTextBox.add( 'P12_CANTIDAD_PEDIDO' , pThis.value);
        });
      }
    );
    </script>
    </head>
    <body>
    <div id="default"></div>
    <p style="clear: both;">
    <button type="button" style="font-weight: bold; width: auto;"                         id="someButton">Agregar Unidades</button><p><span class="demoLabel"></span></p>
    </body>
    </html>
4

1 回答 1

1
$("#someButton").click(
  function(){
    $("input[name=f_qty]").each(function(){
       var valueInCurrentTextBox = $(this).val(); //take action here
    });
  }
);

尝试类似上面的方法。单击按钮时,它会遍历所有文本框

于 2013-08-16T04:37:53.263 回答