jquery css background image
-
I want to put a background image in a div using the jquery .css function but for some reason it doesn’t work. The funny thing is, setting the background to a color works, and I have done this in other sites that aren’t wordpress sites before. Is this a wordpress issue? I mean the code is pretty simple:
<div id = "somediv"> </div> <!-- and a couple lines beneath it I have --> <script> $('#somediv').css('background','url("images/image.jpg")'); </script>
naturally the div has a width and height and everything in the css file. Anyway if I were to replace ‘url(“images/image.jpg”)’ with ‘black’ or some other color it works. Does anybody have any idea with what could be going on here?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘jquery css background image’ is closed to new replies.