I have created a Laravel 5.6 project on my local.
I have <script src="" defer></script>
in <head>
In one of the views, I tried
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( "#ddtype" ).change(function() {
alert( "Handler for .change() called." );
});
});
</script>
but it gives me jQuery is not defined
error
If I try Bootstrap 4's collapse function, it works fine. Does that mean jQuery is already included?
I have done npm install
and npm run dev
My resources/js/app.js
requires bootstrap.js
which looks like (not full code but top few lines) as below
window._ = require('lodash');
window.Popper = require('popper.js').default;
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
Please advise.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IdkG29
via IFTTT
Aucun commentaire:
Enregistrer un commentaire