0

Sorry for the stupid question. I tried looking for an answer somewhere, but couldn't find any. I can't get this code to work:

<div onmouseover="this.style.backgroundImage = 'url('#')'";>
</div>

Help?

3
  • what exactly you want to achieve, can you please elaborate Commented Apr 2, 2017 at 16:58
  • I'm trying to make the div change to a different background on mouseover. The # is not the actual link for the picture. Commented Apr 2, 2017 at 17:01
  • In case of url you need not use the string quotes for the url try <div onmouseover="this.style.backgroundImage = 'url(someurl)'";> </div> Commented Apr 2, 2017 at 17:08

1 Answer 1

3

Escape single quotes:

<div onmouseover="this.style.backgroundImage = 'url(\'#\')'">
</div>
Sign up to request clarification or add additional context in comments.

2 Comments

That's what I tried at first, but it didn't work. Weird.
nvm Thank you so much!

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.