jQuery: outer html() [duplicate]

Just use standard DOM functionality:

$('#xxx')[0].outerHTML

Or a bit simpler with .prop():

$('#xxx').prop('outerHTML')

outerHTML is well supported – verify at Mozilla or caniuse.

Leave a Comment

error code: 523