On the page is connected jQuery UI Datepicker:

<script> $(document).ready(function(){ $("#date").datepicker(); }); </script> <input id="#date"> 

$(document).ready(function(){ - means that the script is waiting for the page to load, well, if I have a very large page and it can load for example 5 seconds. I want to use the calendar right away without waiting for the full page load, then how change script?

    2 answers 2

     <input id='date'> <script> $("#date").datepicker(); </script> 

    like so :-)

    • 3
      +1, only imho is a stupid idea for a vehicle ... - thunder
    • @thunder yes why stupid? Maybe you just need to screw this element. The crutch is certainly not good, but I don’t want to touch the engine either :-) - lampa
    • Yes, I did not work that way, did not notice the order, I first had the JS file connected and then input ... if $ (document) .ready (function () {- then it does not matter, and if without it, then it has an essence .. Thank you! - Epexa

    Write without ready , nobody forbids, but the consequences may not be predictable ... In particular, the <input..> field may not have time to load, then the script will not work ... jQuery itself may not initialize ... Yes, a lot of that can happen ... IMHO maybe it makes sense to think about reducing the page size.