Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Data attribute problem

Hello guys,

What exactly is problem with this code, something with background is not ok, it won't show up photos I put in?

<blockquote data-cycle-pager-template='<a href=""><div class="hexagon" style="background-image:url("http://www.texturezine.com/wp-content/uploads/2014/05/turquoise-polygon.jpg");"><div class="inhexagon"></div><div class="hexTop"></div><div class="hexBottom"></div></div></a>'>

2 Answers

Try escaping your " within a " in the 'style=background"' attribute of the div with a class of "hexagon" like so:

<blockquote data-cycle-pager-template='<a href=""><div class="hexagon" style="background-image:url(\"http://www.texturezine.com/wp-content/uploads/2014/05/turquoise-polygon.jpg\");"><div class="inhexagon"></div><div class="hexTop"></div><div class="hexBottom"></div></div></a>'>

I believe the problem you ran into was having a double quote inside of another double quote without escaping the second set of double quotes by putting a \ before it. You have to escape the quotes anytime you use a duplicate set of quotes within a string i.e.

"My name is Captain \"Red Beard\" Spaulding, and I'm gonna peg ye to death, ye landlubber!"

Tried that already... Not working.. I'm starting to lose hope :/

I don't know what you mean by you've "tried that already"? Your code did not reflect the correct way to escape quotes, so if you copied and replaced that original line with mine (and everything else is correct) your code should be working now.