1. 程式人生 > >jQuery mobile報錯 Uncaught TypeError: Cannot read property 'concat' of undefined

jQuery mobile報錯 Uncaught TypeError: Cannot read property 'concat' of undefined

typeerror html error 錯誤 query doctype src mobile scrip

寫一個jQuery mobile的demo

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
    </head>
    <body>
        <div data-role="page">
            <div data-role="header">頁眉</div>
            <div data-role="content">內容</div>
            <div data-role="footer">頁腳</div>
        </div>
        <script src="js/jquery.min.js"></script>
        <script src="js/jquery.mobile-1.4.5.js"></script>
    </body>
</html>

用瀏覽器打開,發現沒有樣式,打開控制臺發現報了一個錯誤

技術分享

上Stack Overflow查了一下,是因為jQuery mobile和jQuery的版本不匹配,我當前的jQuery mobile的版本是1.4.5,jQuery的版本3.2.1, jQuery重新下2版本以下的試試,我下了1.9.1是可行的

jQuery mobile報錯 Uncaught TypeError: Cannot read property 'concat' of undefined