index.jsp
<script type= "Text/javascript" src= ". /js/my.js "></script>
<DivID= "chapter"> <P>How admirable are the law of compensation!<spanID= "footnote">Today is monday!</span><spanclass= "Pull">A Wonderful day!</span></P> <P>And how perfect a proof of the natural fitness!<spanID= "footnote">Today is friday!</span>I believe you!</P> <P>Next above these come the nobility<spanID= "Drop">, of Whom there are!</span><spanID= "footnote">Today is saturday!</span>If you work hard,you'll succeed!</P> </Div> <Divstyle= "width:500px;height:500px;"></Div> <ahref= "#top"style= "display:block;margin:0px;padding:0px">Back to Top</a> <DivID= "Footer"></Div>
My.js
$ (document). Ready ({var$note =$ ("<ol></ol>"). InsertBefore ("#footer"); $("Span#footnote"). each (function(Index) {$ ( This). before (["<a href= ' #footnote--", Index+1, "' Id= ' context-", Index+1, "' class= ' context ' > ', "<sup style= ' font-size:15px ' >", Index+1, "</sup></a>"].join (""))//Reverse Insert. append (["<a href= ' #context-", Index+1, "' >context</a>"].join ("" ") . AppendTo ($note). Wrap ("<li id= ' footnote-" + (index+1) + "></li>"); });});
Use of footnotes------jquery