I am trying to Convert only img tag wit div tag by using jQuery
<img class="wrap" src="xyz.com" alt="test" />
<div class="test"></div>
with
<div class="wrap" src="xyz.com" alt="test" />
Trying like this
var $select = $(".wrap");
var $div = $(".test");
var attributes = $select.prop("attributes");
$.each(attributes, function() {
$div.attr(this.name, this.value);
});
Above code is copying all attribute from img and assigning to div tag. I want to achieve the same without assigning to html. Simply i want replace img tag with div tag. Is that possible?