Get HTML String for jQuery and/or DOM object

后端 未结 3 541
南方客
南方客 2021-01-13 22:21

I think I\'ve read through the complete jQuery API documentation and looked at jQuery objects and simple DOM elements in the debugger to check what methods they actually hav

相关标签:
3条回答
  • 2021-01-13 22:53

    try the dom property .outerHTML

    0 讨论(0)
  • 2021-01-13 23:08

    This is possible by enclosing your desired object in another object, and the fetching the innerHTML. It is explained in much more detail here: How do you convert a jQuery object into a string?

    0 讨论(0)
  • 2021-01-13 23:12

    You can use the '.outerHTML' property. This is how it would look using jquery: http://jsfiddle.net/MHvmm/

    $('div')[0].outerHTML
    
    0 讨论(0)
提交回复
热议问题