小编Ani*_*ukh的帖子

如何使用jquery操作HTML元素?

我有这个表从数据库加载,所以所有元素each row都具有相同的属性.

<table class="table table-responsive">
    <tr>
        <th>Product name</th>
        <th>Quantity</th>
        <th>Price per unit</th>
        <th>Total</th>
        <th>Action</th>
    </tr>
    <tr>
        <td class="product-name">Product one name</td>
        <td class="product-quantity">
            <!-- plus button should increase quantity and update total based on unit_price*quantity  -->
            <button class="btn"> +</button>
            <input type="text" value="2"/>
            <button class="btn"> -</button>
        </td>
        <td class="unit-price">50</td>
        <td class="total-price">100</td>
        <td>
            <!-- this should delete entire row -->
            <button class="product-delete">Delete</button>
        </td>
    </tr>
    ...
</table>
<!-- on each quantity change this needs to update -->
<div class="grand-total"> 5000 </div>
Run Code Online (Sandbox Code Playgroud)

我试图制作 …

html database jquery dom

5
推荐指数
1
解决办法
204
查看次数

标签 统计

database ×1

dom ×1

html ×1

jquery ×1