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

后端 未结 5 1699
青春惊慌失措
青春惊慌失措 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:48

    You can use javascript slice method this way:

    var html = ''+
    ''+
      '' +
        ' '+
        '' +
      '' +
      'Some Text!' +
    ''
    var bEnd, bStart;
    bStart = html.indexOf("

提交回复
热议问题