I been using jQuery for a while, but cant seem to gert my head round this…
I have a HTML layout like so:
<div id="wrapper">
<div class="accordionButton">
<h2 class="profiletitles">Requested <?php $count = 0; ?></h2>
<span class="trainingHeaderCount"></span>
</div>
<span class="postCount">12</span>
</div>
And I am trying to populate the <span class="trainingHeaderCount"></span> with the <span class="postCount">12</span>.
What I have so far is:
$('span.trainingHeaderCount').html($(this).parent().parent().find('.postCount').html());
But its not loading anything into the DIV. It masy be something to do with the misuse of the “this” but not sure..
Thanks
In your code
$(this)is undefined.Try this:
SEE DEMO