从javascript中的php table loop获取值并更改php中的值

时间:2018-12-10 17:17:48

标签: javascript php

When i clicked the + button the quantity value is changed. But I want to change the value of Price and then total.

我的代码在这里。

  <tr class="rem1" id="test">
    <td class="invert">
      <div class="quantity"> 
       <div class="quantity-select">                           
        <div class="entry value-minus">&nbsp;</div>
        <div class="entry value"><span>1</span></div>
        <div class="entry value-plus active">&nbsp;</div>
       </div>
      </div>
    </td>
    <td class="invert"><span class="pr"><?php echo $row['product_price']; ?> </span>
   </td>
 </tr>
 <tr>
   <td><?php echo $total; ?>
   </td>
 </tr>
   <script>
    $('.value-plus').on('click', function(){
    var divUpd = $(this).parent().find('.value'), 
    newVal = parseInt(divUpd.text(), 10)+1;
    divUpd.text(newVal);

    var Row = document.getElementById("test");
    var Cells = Row.getElementsByTagName("td");
    var valGet = Cells[0].innerText;
    var prGet = Cells[1].innerText;
    // here is logic to change the values of price and total
    // If multiple row its only get last row value.
    });
   </script>

0 个答案:

没有答案