1

Possible Duplicate:
Get selected element's outer HTML

Please get me out of this doubt.
My HTML code is

<div id="ToBe"><div class="text">Hello</div></div>

My jQuery code is

var x=$('#ToBe').html();
alert(x);

But it is displaying

<div class="text">Hello</div>

But my requirement is to display

"<div id="ToBe"><div class="text">Hello</div></div>" 

as output.
How can i get that.

Community
  • 1
  • 1
Reddy
  • 1,327
  • 3
  • 23
  • 44
  • Sorry i did not see that. :-( – Reddy Jul 19 '11 at 07:27
  • 2
    @Prathap: that’s alright — it’s good to have the question in Stack Overflow with your wording, because then people asking it in the future have a better chance of finding the existing answer. – Paul D. Waite Jul 19 '11 at 07:32
  • @Ben: well-spotted. If you could vote to close this question as a duplicate of the one you linked to, future searchers will get redirected to the existing answer. – Paul D. Waite Jul 19 '11 at 07:33
  • @Paul You are so right and kind. :) – Sanghyun Lee Jul 19 '11 at 07:36
  • @Sangdol: aw! Cheers! I’m actually a phenomenal bastard, but I do like having answers to every possible phrasing of every possible coding question ready in Stack Overflow for when I need to look it up :) – Paul D. Waite Jul 19 '11 at 07:48

0 Answers0