javascript - Js files not loading properly -


css files seem load properly. js files seem load, of them inactive, no error message on consol.

my files are:

    <head>     <link rel="stylesheet" href="/static/libs/font-awesome4/css/font-awesome.min.css">     <link rel="stylesheet" type="text/css" href="/static/libs/bootstrap/dist/css/bootstrap.min.css">     <link rel="stylesheet" type="text/css" href="/static/css/style.css">     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>     <script type="text/javascript" src="/static/js/script.js"></script>     <link rel="stylesheet" href="/_debug_toolbar/static/css/toolbar.css?0.7082793798424954" type="text/css"> </head> 

the file site-specific script.js. script.js short code below:

$.fn.countdown = function (callback, duration, message) {     message = message || "";     var container = $(this[0]).html(duration + message);     var countdown = setinterval(function () {         if (--duration) {             container.html(duration + message);         } else {             clearinterval(countdown);             callback.call(container);            }     }, 1000); };  // use p.countdown container, pass redirect, duration, , optional message $(".countdown").countdown(submit_on_time, 30, "s remaining");  // function called after 5 seconds function submit_on_time () {     $('#interview-form').submit(); } 

enter image description here

i having hard time finding source of problem.

your script in <head> section, before of elements available, $(".countdown") returns empty object.
need add $(document).ready() or place scripts @ bottom, right before </body> (or @ least below elements you're trying access).

$.fn.countdown = function (callback, duration, message) {     message = message || "";     var container = $(this[0]).html(duration + message);     var countdown = setinterval(function () {         if (--duration) {             container.html(duration + message);         } else {             clearinterval(countdown);             callback.call(container);            }     }, 1000); };  // function called after 5 seconds function submit_on_time () {     $('#interview-form').submit(); }  // use p.countdown container, pass redirect, duration, , optional message  $(document).ready(function() {     $(".countdown").countdown(submit_on_time, 30, "s remaining"); }); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -