0
我有一個FireFox 3.6的問題,不喜歡我在jQuery(v1.7.2)中調用非jQuery函數。FF 3.6和jQuery 1.7和removeEventListener()
砍掉版本的我的代碼:
function doInitialiseForm(theField) {
/* loop through a few fields and set the appropriate attributes & class */
nX = parseInt(theField) ;
var inputElement = '' ;
for (i=(nX + 1); i <= 10 ; i++)
{
$('#acBox' + i).addClass('pHide') ;
/* toggle the required attribute/class on the input boxes - for HTML5 input validation to behave correctly ... */
inputElement = document.getElementById('acBoxName_' + i) ;
inputElement.removeAttribute('required');
$(inputElement).removeClass('required')
}
}
$(document).ready(function() {
if (isBookingPage == '1')
{
doInitialiseForm(document.getElementById('AttendingCount')) ;
}
});
錯誤Firefox是報告:
Error: uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http//development_server/Booking/js/script.js :: doInitialiseForm:: line 65" data: no]
這似乎是與FF期待第三個參數removeEventListener()
啄,這是可選。但是,我不直接使用removeEventListener()
。
爲了讓上面的代碼在老版本的FireFox中工作,我需要實現哪些附加代碼?
Firefox 3.6的支持截至2012年4月24日,你仍然支持它? – epascarello 2012-07-17 18:38:33
爲什麼要混合使用DOM和jQuery? '$('#acBoxName_'+ i).removeAttr('required')。removeClass('required');' – epascarello 2012-07-17 18:42:03
對DOM對象的parseInt,這是如何工作的? – epascarello 2012-07-17 18:43:46