I need to append the img inside an <a> tag. I have been hacking at this and no resolve, driving me crazy. If you can help that would be great. I am using jQuery 1.5
while condition{
$("<img>").attr("src", thumb).appendTo("#images");
}
End result should be:
<a href="#"><img src="xxxxx"></a>
When I use prepend or appendto I get this result:
<div id="images src="xxxxxxx"><a></a>
OR
<a href="#"></a><img src="xxxxx">
Thanks for any assistance.
working example: http://jsfiddle.net/hunter/Rxkxg/