Change node type

前端 未结 4 1651
广开言路
广开言路 2021-01-05 03:44

Using jQuery, is it possible to change all matched elements to a different type?

For example, can I select all a tags, $(\"a\"), and change

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-05 04:17

    $("a").each( function() {
        this.replaceWith( $("").html( this.innerHTML() ) );
    });
    

提交回复
热议问题