2017-08-17 34 views
2

我已經下載的jQuery 3.2.1和jQuery UI 1.12.1和我加載它們,像這樣:jQuery是不是(在jQuery UI的)定義

<script src="js/jquery-3.2.1.min.js" type="text/javascript"></script> 
<script src="js/jquery-ui.js" type="text/javascript"></script> 
<link rel="stylesheet" type="text/css" href="css/style.css"> 

我得到一個未捕獲引用錯誤:

Uncaught ReferenceError: jQuery is not defined(anonymous function) @ jquery-ui.js:14(anonymous function) @ jquery-ui.js:16 index.html:165 Uncaught TypeError: table.insertRow is not a functionObject.keys.forEach.key @ index.html:165loadResultsIn @ index.html:164loadhistory @ index.html:186onload @ index.html:12

我正在嘗試將此與Electron配合使用。不確定這裏發生了什麼事。從CDN的還試圖加載和有同樣的問題

+0

可能是你的腳本的位置。是不是你的錯誤指的是index.html中的錯誤?也許你嘗試使用jQuery? – lscmaro

+0

要麼使用最新的'jQuery-ui'庫,要麼將主jQuery庫降級到較老的''以支持'jQuery'語法 –

+0

@lscmaro我還沒有使用jQuery,只能鏈接到它! – K20GH

回答

2

在這裏找到解決方案: Electron: jQuery is not defined

<!-- Insert this line above script imports --> 
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> 

<!-- normal script imports etc --> 
<script src="scripts/jquery.min.js"></script>  
<script src="scripts/vendor.js"></script>  

<!-- Insert this line after script imports --> 
<script>if (window.module) module = window.module;</script>