jQuery does not work at all! What could be the problem? Here all the code post:
& lt; body & gt;
& lt; div id = "bg" & gt; & lt; / div & gt;
& lt; script type = "text / javascript" src = "script / myscript.js" & gt; & lt; / script & gt;
& lt; script type = "text / javascript" src = "script / jQuery-2.0.0.min.js" & gt; & lt; / script & gt;
& lt; / body & gt;
myscript.js:
$ ('# BG'). CSS ('Background-Color', '# 000');
put it:
$ (document) .ready (function () {
$ ('# BG'). CSS ('Background-Color', 'Green');
});
does not work and does not react! What’s the matter? My head is not working. In the morning I suffer over him.
Answer 1, Authority 100%
Change places, so:
& lt; script type = "text / javascript" src = "script / jQuery-2.0.0.min.js "& gt; & lt; / script & gt;
& lt; script type = "text / javascript" src = "script / myscript.js" & gt; & lt; / script & gt;
UPD:
Do you have what should happen? Judging by your code, the ID = “BG” block should be painted in green. It will happen if you add any content to this block or simply set the height via CSS. Without content and without explicit indication of height, the unit has zero height and as a result is not visible.
Answer 2, Authority 100%
You download scripts to the HTML document header. Therefore, the sequence matters. First you need to load jQuery and then executed script.
Answer 3
Background-color
in javascript looks like backgroundsolor
, by analogy All other elements with a Fname-Sname = & gt defis; FnamesName