[jQuery] How to retrieve all content within an element's start and end tags
Hi,
I have a <div id="content"> and I want to set it's text dynamically:
when user clicks a text, the content of a hidden element is
retrieved and is displayed in the <div id="content">. Problem is: if
the text I retrieve from the hidden
also contains HTML, that html
is not fetched.
This is roughly how the relevant html looks:
<div id="content">
<!-- show some text here -->
</div>
<p id="about">
We create great products:
<ul>
<li>Airplanes</li>
<li>Boats</li>
<li>Helicopters</li>
</ul>
<p id="contact">
This text has to be shown, but only when I click text 'contact
I can write jquery that retrieves the text but it will not fetch the
<ul>:
$("about").text()
gives
We create great products:
$("about").html()
gives
We create great products:
I want:
We create great products:
<ul>
<li>Airplanes</li>
<li>Boats</li>
<li>Helicopters</li>
</ul>
what jquery do I need to get this and display it again???
Thanks