img标签使用jQuery转换为div标签
我想通过使用jQuery将页面的所有img标记更改为div标记。 恩。
通过使用jQuery它转换成
this text i want in div
我们如何通过使用jQuery来做到这一点?
你可以使用replaceWith
这是一个小提琴: http : //jsfiddle.net/Am75c/
$('img').each(function(){ $div = $('').html($(this).attr('alt')); $(this).replaceWith($div); });