Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何更改<footer id="tt"></footer>使用<div id='tt'></div>jQuery 有没有办法轻松更改标签?非常感谢
<footer id="tt"></footer>
<div id='tt'></div>
您可以使用replaceWith方法:
replaceWith
$('#tt').replaceWith(function(){ return '<div id="' + this.id + '"></div>' })
您可以使用replaceWith()
replaceWith()
var $foot=$('#tt'), html=$foot.html(); $foot.replaceWith( $('<div id="tt">').append(html) )