That’s happens because the script
run before document
is ready
. ( sync ).
If you want to keep your script
at the beginning of the body
, or in head, use de window.onload
function.
window.onload = function()
{
// your code goes here
}
My suggestion will be to place the
script
at the end of the body, also
thebootstrap
andjquery
libs, because those scripts will be fired
after the DOM is ready.
solved Moving a