I am little confused here. I would like to have this structure.
<ul class="cont">
<li>
<a href="http://www.youtube.com/watch?v=my_video_id" title="My title">
<img alt="my alt" src="http://img.youtube.com/vi/my_video_id/default.jpg" <="" a="">
</a>
</li>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
I did that using,
list_data += '<li><a href="' + url + '" title="'
+ feedTitle + '"><img alt="' + feedTitle + '" src="'
+ thumb + '"</a></li>';
As I wanted to escape the title (and description which I avoided here for an abstract view of the problem), I tried to do it the jQuery way. ie,
$('<img/>').attr({
alt: feedTitle,
src: thumb
}).wrap('<a/>').attr({
id: 'id_' + videoID,
href: url,
title: description,
rel: 'external'
}).wrap('<li/>').attr({
class: 'video'
}).appendTo(".cont");
This is not working. I am doing something very very wrong. How to correct this?
JSFIDDLE: http://jsfiddle.net/e54VX/
attr. @Bartitude: the expected HTML has been posted on the top of the question