Reputation: 63
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();
Upvotes: 0
Views: 57
Reputation: 3834
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>
Upvotes: 1