dow56114 2014-01-20 04:30
浏览 64
已采纳

无法从字段jquery mobile读取值

my html code

<?php 
  while($results = $user_class->fetch_array($sql)){
?>
  <input type="text" name="price[]" class="price" id="price" 
    size="5px" readonly value="<?php echo $results['price_v'] ?>">
  <select onChange="update(); return false;" name="qty[]" class="quant">
    <option value="0"></option>
    <?php 
      $limit = $results['limiter'];
      for($i=1;$i <= $limit;$i++ ){ 
    ?>
      <option value="<?php echo $i?>"><?php echo $i?></option>
    <?php } ?>
  </select>

this is my jquery code

$("#example_form tr.raww").each(function(i,o){ 
  if($(o).find(".quant").val()>0) { 
    total += $(o).find(".quant").val() * $(o).find(".price").val(); 
  } 
});

if i attach

<script type="text/javascript" src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>

My jQuery can't read the value from the field.
And if i remove that jquery mobile can read value from field.

http://jsfiddle.net/QJxYv/3/

Is there anything wrong with my jQuery code?

  • 写回答

2条回答 默认 最新

  • doushishi6513 2014-01-20 06:23
    关注

    Your code will work as long as there is only one element with class quant and one element with class price in each row of class raww.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向