JS - Remove a tag without deleting content

前端 未结 8 1167
渐次进展
渐次进展 2021-01-04 04:09

I am wondering if it is possible to remove a tag but leave the content in tact? For example, is it possible to remove the SPAN tag but leave SPAN\'s content there?



        
8条回答
  •  感动是毒
    2021-01-04 04:37

    $(function(){
    
       var newLbl=$("p").clone().find("span").remove().end().html();
        alert(newLbl);
    
    });​
    

    Example : http://jsfiddle.net/7gWdM/6/

提交回复
热议问题