Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Use JQuery to append content on page to other elements



2:26 am on Oct 24, 2011 (gmt 0)

5+ Year Member

I'm limited to using only one include on a page for a content management system and I want to take the content of the <h1> within this include and append it elsewhere on the page using JQuery.

So I want it to read a specific <h1> and append inside the title meta tag and an <h3> tag. Is this possible? Any help would be greatly appreciated!


9:28 pm on Oct 26, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

To get the text and assuming you have a single h1 in the page,

<div><h3 class="subhead">Sub-Heading</h3></div>

var h1_text = $('h1').text();
var title = $('title').text();

Not sure what you meant with h3. If you meant to get the h3 too just add another var and append it.
var subhead = $('.subhead').text();


10:48 pm on Oct 26, 2011 (gmt 0)

5+ Year Member

That's exactly what I needed. Thank you very much!

Featured Threads

Hot Threads This Week

Hot Threads This Month