Sunday, May 21, 2017

Laravel: Scripts inside of sections aren't recognizing CDN dependencies

I am trying to run a script inside of a section with laravel which uses momnetjs.

<script>
        var updateClock = function() {

            var now = new Date();
            var m = new moment();

            var time = m.format('h:mm a');

            $('#clock').html(time);

            this.document.getElementById('clock').innerText(time);

            var delay = 1000 - (now % 1000);
            setTimeout(updateClock, delay);
        };
        updateClock()
    </script>

It is is a file which extends main which has this <script src="https://momentjs.com/downloads/moment-with-locales.js"></script> in the body. I can't see why this wouldn't be working. Thanks in advance for the help!



via Caleb Bassham

Advertisement