How can I create dynamic tags?
$("<img />").attr({
id: "image-1",
src: "/images/flower.png",
}).appendTo("#" + imgContainer);
It will create <img src="/images/flower.png" id="image-1" />
I want to create <span> tag around <img> tag.
i.e. <span><img src="/images/flower.png" id="image-1" /></span>
You can use
wrap():