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.

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

Punca ralat
[code lang=”html”]
<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>[/code]

Penyesaiannya adalah dengan memuat jQuery terlebih dahulu
[code lang=”html”]
<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>[/code]

Leave a Reply

Your e-mail address will not be published. Required fields are marked *