Tim
Tim

Reputation: 2649

Getting Javascript to show HTML in popup

I have this site I've been working on here: http://www.replyonline.co.uk/DirectionGroup/xmas/index.php

When you hover over the first photo at the top, a voting box appears. Now if you click on the photo it displays the 'By whom' name and 2 numbers (the vote results). Both the photo thumbnail and the enlarged lightbox share the same HTML content as each other.

What I don't understand is why the enlarged box doesn't display the HTML properly, just the 2 numbers from the voting element rather than the voting element itself.

If you look at the source, you can see down the page in the code is the javascript and I can't figure out what I need to change to the JS in order to make HTML display on the larger view?

Here is an example of what the markup is for each thumbnail you click:

<a href="#"><img src="images/thumbs/1.jpg" data-largesrc="images/large/1.jpg" alt="image01"/><span>By Tim Morgan <?php echo ThumbsUp::item('1')->template('thumbs_up_down') ?></span></a>

As you can see, there is the thumb source and the large source as well as the voting function.

Upvotes: 2

Views: 599

Answers (2)

Dylan Valade
Dylan Valade

Reputation: 5605

It may help to clone() the forms so they exist on the previews.

Upvotes: 1

pimvdb
pimvdb

Reputation: 154818

It turns out you have to set HTML with the .html method - currently you're converting the whole to text and then setting text.

Secondly, it looks like .tmpl does not like HTML. If you also set the HTML the first time (when doing .tmpl), it should always work.

Upvotes: 1

Related Questions