Mar 4, 2012 at 6:20 PM
Edited Mar 4, 2012 at 6:20 PM
The complete HTML body of your post would be something like this:
<div class="chapter" align="justify" >
$('<a href="#top">Up</a>').insertAfter('div.chapter p');
This will effectively insert a hyperlink with the text "Up" just below the content of your post.
However, might I suggest that you should not mix script with content.
Instead, what you would want to do is override the template of the blog post, in which you insert the link to the anchor at the top (you should even omit the script entirely, as it doesn't do anything that you couldn't do with plain HTML).
Also, in your Layout.cshtml, add the anchor with id "top", so that the link in your blog post template will work.
Doing that will have at least 3 benefits:
- No repetition of scripts in each and every blog post
- No scripts mixed with content