i'm trying to learn some jQuery and i need some help on this little program, like you see i have a header which contains some text and i need to make sure that it expands to it's HTML content once been clicked using Toggle()
.
This my HTML
<body>
<div class="tog">
<h1 id="hh">
<span> Click me to see my HTML content <span>
<!-- A comment -->
</h1>
</div>
</body>
Here is my jQuery code
<script src="jquery.js"></script>
<script>
$(function ()
{
$(".tog").click(function (){
$('#hh').slideToggle("slow");
$(this).toggleClass("active");
if ($(this).text() == "Click me to see my HTML content ")
$(this).html(h1);
else
$(this).text("Click me to see my HTML content ");
});
</script>