1

I have the code snippet below. I am expecting the div to have that background logo. It's not happening. All js files are loaded correctly as other parts of the page work fine.

Two questions:

1- Using a network sniffer I don't see a request for logo.png. Possible reasons why?

2- Is there a way to know what url path the browser is using without using a network sniffer? I wanted to know if I should use ./ or ../ or whatever for the correct full path.

<script type="text/javascript">

    $(document).ready(function() {
        $("#test").css("background-image", "SomeLongMultiLevelPath/logo.png" );
    });

</script>

<div id="test">
</div>
1
  • 2
    idk, but shouldn't the url be url(images/image.png)? Commented Jan 26, 2011 at 1:27

2 Answers 2

3

Try this:

$("#test").css("background-image", "url(SomeLongMultiLevelPath/logo.png)" );

... assuming your image path is right.

Sign up to request clarification or add additional context in comments.

Comments

1

Yes, so it was as I said: url(SomeLongMultiLevelPath/logo.png) As for the directory, the dots are used to go up by one level:

//Home
// Dir1
//// Image.png url(../Dir1/image.png)
// Dir2
//// Yourpage.html

1 Comment

The second question was about how to know what's the full url the browser is using for a certain request (I know now). it's not what the dots mean.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.