Print out jQuery object as HTML

后端 未结 3 1632
再見小時候
再見小時候 2020-12-29 23:20

Is there a good way of printing out a jQuery object as pure HTML?

ex:





        
3条回答
  •  甜味超标
    2020-12-29 23:36

    $('img')[0].outerHTML

    will give you the HTML of the first img on the page. You will then need to use a for loop to get the HTML of all the images, or put an ID on the image and specify it only in the jQuery selector.

提交回复
热议问题