How to get head and body tags as a string from html string?

后端 未结 5 1702
青春惊慌失措
青春惊慌失措 2021-01-15 13:22

Hey i have an html string i\'m having trouble getting the tags from.

I have tried alot of stuff, here are some :

var head = $(\"head\",$(htmlString))         


        
5条回答
  •  走了就别回头了
    2021-01-15 13:33

    may be this can help you

    var head = jQuery('
    ').append(htmlString).find('head').html(); var body = jQuery('
    ').append(htmlString).find('body').html();

提交回复
热议问题