[英]JS / JQuery - Object doesn't support this property or method - ie7/8
獲取錯誤Object doesn't support this property or method
鏈接到以下代碼塊的Object doesn't support this property or method
。 它僅在ie7和8中發生。
我正在使用JQuery版本1.9.1
有人可以幫忙嗎?
function get_vehicle_data() {
v = $('#vehicle'+current.vehicle);
vehicle = {
id: v.data('vehicle-id'),
title: v.text(),
code: v.data('code'),
example: v.data('example'),
largeBags: parseInt(v.data('large-bags')),
smallBags: parseInt(v.data('small-bags')),
weight: parseInt(v.data('weight')),
rates: v.data('rates').split(':'),
passengers: parseInt(v.data('pax'))
}
}
根據此jQuery API文檔 -
由於瀏覽器與插件和外部代碼進行交互的方式,
.data()
方法不能用於<object>
(除非它是Flash插件),<applet>
或<embed>
元素。
您可能想找到一個替代方案
現在,我來看一下,可能是您如何定義v = $("#vehicle" + current.vehicle);
除非在其他地方定義電流,否則您將使用current作為沒有“車輛”方法的對象。 這可能是您的問題。 提供一個JSFiddle或完整的JS代碼將對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.