jQueryUI Datepicker works fine when ran outside of Laravel application. Here is the code: https://jqueryui.com/datepicker/ Implementing the same code from within any laravel blade view returns a "datepicker" not defined in the developers console(browser).
Commenting out the line:
{{-- <script src="{{ asset('js/app.js') }}" defer></script>--}}
in the app.blade.php file and the jquery date picker works.
I just tried this out on a (relatively) fresh install of Laravel and the datepicker worked as expected without commenting out the app.js reference. But I am not using a Windows machine or XAMPP (Mac/Valet/PHP 7.2.17 instead).
That being said, I am not sure how those environment differences would cause the issue. Did you try it with a fresh install of Laravel?
Yes
Can also be resolved if defer is removed from the script.
<script src="{{ asset('js/app.js') }}" defer></script>
<script src="{{ asset('js/app.js') }}" ></script>
@570studio Did you run php artisan make:auth ?
@mikestratton I did run php artisan make:auth. Looks like your PR got merged though, so 👍
Hi, @570studio
After running php artisan make:auth, did it work for you?
Now the removal of the defer breaks My Vue app. I now have to move the script to the bottom of the page.
Yeah the removal of defer doesn’t make sense without also moving the script tag to the bottom. Not sure why that was merged.
I've reverted the pr for now.
The state of this after the revert, is more than sufficient for a starter scaffold. Of course there will be situations where you'll need to change it, but that should be handled in the individual app as the need arises. As it is, it suffices the 80% use-case.
I strongly disagree. I am using jQuery in some but not all html forms. I create a view just for this form. There is no need to compile all the required code in JavaScript when it is not widely used.
I have found a lot of mid level developers struggling with this. Just Google “jquery not working with Laravel”.
The ability to add an additional script that does not break the site should be the default working state. developers should not be required to compile everything. It should be an option and is a good coding practice to compile, but lack thereof should not break the app.
The “defer” seems to be a symptom of a much bigger problem.
Ease of use is a must and what has drawn many to laravel. Ignoring this bug will only offer continued frustration for thousands of developers.
If @taylorotwell agreed with the initial commit, why revert his commit?
This pr breaks the most fundamental concept of mixing javascript and html.
Yes but so does the current state with defer.
If moving the script to the bottom of the page allows the use of jQuery libraries, why not just do that?
So, in essence, it is ok to deliver an html page that reads only one script?
We won't be reverting this. Feel free to change this in your own codebase.
Ok, thanks for the review.
answer:
Delete "defer" from js/app.js and all another scripts write after js/app.js
<script src="{{ asset('js/app.js') }}" ></script>
<!-- Jquery scripts -->
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!-- your scripts -->
<script src="{{ asset('js/script.js') }}"></script>
respuesta:
Eliminar "aplazar" de js / app.js y todos los otros scripts escriben después de js / app.js<script src="{{ asset('js/app.js') }}" ></script> <!-- Jquery scripts --> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!-- your scripts --> <script src="{{ asset('js/script.js') }}"></script>
Perfecto!! me funciono!!
answer:
Delete "defer" from js/app.js and all another scripts write after js/app.js<script src="{{ asset('js/app.js') }}" ></script> <!-- Jquery scripts --> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!-- your scripts --> <script src="{{ asset('js/script.js') }}"></script>
thanks a lot, It was huge relief really I don't know how to thank you
Most helpful comment
answer:
Delete "defer" from js/app.js and all another scripts write after js/app.js