I\'m trying to apply CSS values with jquery but class selector or id selector does not not work for some reason.
Here is my fiddle:
As you can see nothing happen
Id selectors are prefixed with #
:
$("#kitten").css("background-position", x + "px 0");
A class selector would be prefixed with a .
, for instance if kitten
were a class:
$(".kitten").css("background-position", x + "px 0");
When you use the body
selector you are using a tag selector which has no prefix.
$("input"); //selects all input tags
For most basic selectors, just follow CSS selector syntax.