Javascript jQuery更改功能在某些浏览器中不起作用';s手机

Javascript jQuery更改功能在某些浏览器中不起作用';s手机,javascript,jquery,html,Javascript,Jquery,Html,这是我的javascript: $(document).ready(function(){ $(".txt-qty").on('change',function(){ var product_variant_id = this.id; var qty = $(this).prop('value'); if(!isNaN(qty) == true) { jQuery.ajax({ typ

这是我的javascript:

$(document).ready(function(){
    $(".txt-qty").on('change',function(){
        var product_variant_id = this.id;
        var qty = $(this).prop('value');
        if(!isNaN(qty) == true) {
            jQuery.ajax({
                type: "POST",
                url: "<?=base_url("/q/qty_data")?>",
                dataType: 'JSON',
                async: false,
                data: {
                    qty: qty,
                    product_id: product_variant_id,
                    payment_method_id : payment_method_id
                },
                success: function (res) {
                    if(res['message'] == 'reload'){
                        location.reload();
                    }

                    var product_variant_id = (res)["id"];
                    var price = (res)["price"];
                    var subtotal = (res)['subtotal'];
                    var total_price = (res)['total_price'];
                    $('#subtotal').html(subtotal);
                    $('#total_price').html(total_price);
                    $('#point_reward').html(res['point']);
                    if (product_variant_id == null) {
                        $(".cart-data-total").html(price);
                    } else {
                        $("#product_price_total_" + product_variant_id).html(price);
                    }
                }
            });
            return false;
        }else{
            alert('Silahkan masukan angka quantity dengan benar');
        }
    });
});
$(文档).ready(函数(){
美元(“.txt数量”)。在('change',function()上{
var product_variant_id=this.id;
变量数量=$(this.prop('value');
如果(!isNaN(数量)=真){
jQuery.ajax({
类型:“POST”,
url:“”,
数据类型:“JSON”,
async:false,
数据:{
数量:数量,,
产品标识:产品变体标识,
付款方式标识:付款方式标识
},
成功:功能(res){
如果(res['message']=='reload'){
location.reload();
}
变量产品变量id=(res)[“id”];
var价格=(res)[“价格”];
var小计=(res)[‘小计’];
var总价格=(res)[“总价格];
$('小计').html(小计);
$('总价').html(总价);
$('point'u raward').html(res['point']);
if(产品变量id==null){
$(“.cart data total”).html(价格);
}否则{
$(“#产品#价格(总计)”+产品(变体)id).html(价格);
}
}
});
返回false;
}否则{
警报('Silahkan masukan angka quantity dengan benar');
}
});
});
这是我的html表单:

<div class="cart-data-qty pull-left col-md-1 col-xs-4">
    <input value="<?=$qty?>" class="form-control txt-qty" data-product-price="<?=$variant_discount_price?>" data-promo-id="<?=$product['promo_id']?>" data-product-variant-id="product_variant" id="<?=$row['product_id']?>" maxlength="2" type="text">
</div>

您可以尝试:
.on('keyup change'
或甚至
。on('keyup change drop-paste'
),而不仅仅是
。on('change'
:)

这应该行得通


祝您好运!

您可以尝试针对不同的事件,例如
keyup
,因为您使用的是
元素