I have this piece of code:
<li class="selected"><a href="/AmIACandidate.html">Am I a Candidate?</a></li>
I need to grab the text "Am I a Candidate?" from inside the tag and move it inside a specific div tag.
<div id="sideNavHeader"> --Copy needs to go here-- </div>
I can copy the whole
Thanks for any help
You probably want to use .text():
$('#sideNavHeader').text($('li.selected a').text());
Tobias Cohen's selector was much better than mine you should use:
$('#sideNavHeader').html($('li.selected a').html());
instead of my original code:
$('#sideNavHeader').html($('li.selected').children('a').html());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With