jQuery在iOS上不起作用,但在所有其他浏览器上都起作用

时间:2019-03-23 19:11:43

标签: jquery ios safari

jQuery在jQuery版本1.12.4的第2129行上没有标题的控制台中引发错误。该问题与处理程序功能有关,仅在iOS上发生。

我正在使用忍者表格,并从听取现场模型变更中解雇。 jQuery可与所有其他浏览器一起使用。

我已经尝试添加文档加载事件和光标指针。似乎我尝试的所有方法均无效。

jQuery(document).on( 'nfFormReady', function( e, layoutView ) {

new updateOutput();

});

var updateOutput = Marionette.Object.extend( {
initialize: function() {

    var fieldsChannel = Backbone.Radio.channel( 'fields' );
    this.listenTo( fieldsChannel, 'change:modelValue', this.updateDays );
},

updateDays: function(model) {
    if(model.get( 'key' ) == "departure_1551883705167") {
    var arrival = document.getElementById('nf-field-18').value;
    arrival = new Date(arrival.split('/')[2],arrival.split('/')[1]-1,arrival.split('/')[0]);
    var departure = document.getElementById('nf-field-19').value;
    departure = new Date(departure.split('/')[2],departure.split('/')[1]-1,departure.split('/')[0]);
    var timeDiff = Math.abs(departure.getTime() - arrival.getTime());
    var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); 
    document.getElementById('nf-field-20').value=diffDays;
    jQuery( '#nf-field-20' ).val( diffDays ).trigger( 'change' );

    }

    if(model.get( 'key' ) == "listradio_1551878042892") {
    var acc = jQuery("input[name=nf-field-9]:checked").val();

    var data = {
        'action' : 'accommodation_costs',
        'accomm' : acc,
    };

    jQuery.post(ajax_objects.ajax_url, data, function(response) {

    jQuery( '#nf-field-21' ).val( response ).trigger( 'change' );

    }); 

    }

    if(model.get( 'key' ) == "bikes_1551882140137") {

    jQuery("input[name=nf-field-13]:checked").each(function() {

  var chkId = jQuery(this).attr("id");
  var inpId = chkId.substring(chkId.indexOf("-") + 1);
  var $inp = jQuery("<input />", {
    type: "number",
    name: "Qty" + inpId,
    id: "Qty" + inpId,
    style: "display:inline-block; cursor:pointer;",
    "onclick": "function () {}"
  });
  jQuery(this).next("label").after($inp);
});

    }
}       
});

0 个答案:

没有答案