Menu Close

Uncaught TypeError: Cannot read property ‘fn’ of undefined

Semasa saya migrasi dari bootstrap 3 ke 4, saya mempunya ralat yang pelik di dalam konsol log Chrome.

Uncaught TypeError: Cannot read property 'fn' of undefined
    at util.js:56
    at util.js:10
    at bootstrap.min.js:6
    at bootstrap.min.js:6

Sekiranya anda mendapat ralat ini, kemungkin anda memuat bootstrap terlebih dahulu dan jQuery kemudian.

Punca ralat

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Penyesaiannya adalah dengan memuat jQuery terlebih dahulu

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x