I have created a Laravel 5.6 project on my local.
I have in
jQuery is loaded via your app.js
, which is only loaded once the page is ready because of the defer
attribute in your script tag.
Your inline script tag where you call jQuery(document).ready
is loaded as the page renders, therefore executed before the app.js
has been loaded. Hence the error, since jQuery is not yet loaded at that time.
To fix it, simply remove the defer
attribute from the script tag.
The defer attribute is a boolean attribute.
When present, it specifies that the script is executed when the page has finished parsing.
For more information about the defer attribute: https://www.w3schools.com/tags/att_script_defer.asp