When I loaded my HTML, I keep getting an error message stating that (function) is not a function. What's going on here? Here's how I have included my scripts and the jQuery itself.
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="js/script.js"></script>
var $title = $('#intro h1');
$title.hide().fadeIn();
That is beacuse you use "slim" version of jQuery which doesn't include many functions.
There is simply no function called fadeIn
.
...jquery-3.2.1.slim.min.js"...
var $title = $('#intro h1'); $title.hide().fadeIn();
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <div id="intro"><h1>Hello world</h1></div>
Just use full version
var $title = $('#intro h1'); $title.hide().fadeIn();
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <div id="intro"><h1>Hello world</h1></div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.