0

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();
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Shane Harper
  • 63
  • 1
  • 9

1 Answers1

1

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>
Krzysztof Janiszewski
  • 3,763
  • 3
  • 18
  • 38