How can I append this URL variable to the list?
I am fiddling around with this: http://jsfiddle.net/Y2ER7/4/
JS:
$(function() {
var pic = "http://jqueryui.com/demos/droppable/images/high_tatras3_min.jpg";
// doesn't work
$("<li><img /></li>").attr("src", pic).appendTo("#album ul");
$("<li><img src='pic' /></li>").appendTo("#album ul");
// hardcoded works
$("<li><img src='http://jqueryui.com/demos/droppable/images/high_tatras3_min.jpg' /></li>").appendTo("#album ul");
});
HTML:
<div id="album">
<ul>
<li>red</li>
<li>green</li>
<li>blue</li>
</ul>
</div>