replace specific tag name javascript

前端 未结 5 1426
清酒与你
清酒与你 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:51

    You can achieve this by using JavaScript or jQuery.

    We can delete the DOM Element(tag in this case) and recreate using .html or .append menthods in jQuery.

    $("#div-name").html("Content here");
    

    OR

    $("Content here").appendTo("#div-name");
    

提交回复
热议问题