jQuery将两个值相乘(codeigniter)

时间:2018-09-09 23:23:42

标签: php jquery html codeigniter

我正在使用codeigniter创建购物车,我想生成总价而不必重新加载页面

这是我的代码

                                                                                                                                                                                     凯斯                                                                                             product_price;?>                                                                                                                                                                                       
                                                                                    

                                                                                <td class="product-quantity" >
                                                                                    <div class="quantity">
                                                                                        <input type="number" step="1" id="item_quantity" min="0" max="" value="1" title="Qty" class="input-text qty text" size="4" pattern="[0-9]*" inputmode="numeric" />
                                                                                    </div>
                                                                                </td>

                                                                                <td class="product-subtotal" >
                                                                                    <span class="woocommerce-Price-amount amount">
                                                                                        Kes 
                                                                                        <span class="woocommerce-Price-currencySymbol" id="total_price"></span>
                                                                                    </span>                 
                                                                                </td>
“>
<script type='text/javascript'>
    $("#unit_price, #item_quantity").keyup(function () {

        $('#total_price').val($('#unit_price').val() * $('#item_quantity').val());

    });
</script>

请帮帮我

0 个答案:

没有答案