replace specific tag name javascript

前端 未结 5 1425
清酒与你
清酒与你 2020-12-29 16:07

I want to know if we can change tag name in a tag rather than its content. i have this content

< wns id=\"93\" onclick=\"wish(id)\">...< /wns>           


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 16:44

    document.getElementById("93").outerHTML = document.getElementById("93").outerHTML.replace(/wns/g,"lmn");
    

    FIDDLE

提交回复
热议问题