1

Possible Duplicate:
Get selected element's outer HTML

I'm getting a class like this:

   <div class="className">
      content in here
   </div>

And then I'm getting it in JQuery like this:

$('.className').html()

Which only outputs:

content in here

When I want it to get everything, including the parent div.

Thanks for any help

Community
  • 1
  • 1
Jordash
  • 1,177
  • 3
  • 9
  • 10
  • Do you mean including the current div tags? or Parent div content(which will have other content along with the current div and its content)? – KishoreK Aug 05 '11 at 09:43
  • 1
    See: http://stackoverflow.com/questions/2419749/get-selected-elements-outer-html (duplicate) – Ariel Aug 05 '11 at 09:43

1 Answers1

1
$('.className').clone().wrap('<div></div>').parent().html();

http://jsfiddle.net/ipr101/WX69N/

ipr101
  • 24,096
  • 8
  • 59
  • 61