May 2017
Intermediate to advanced
448 pages
10h 10m
English
A feature commonly seen on FAQ pages is the back to top link that appears after each question-and-answer pair. It could be argued that these links serve no semantic purpose, and therefore they can be legitimately included via JavaScript as an enhancement for a subset of the visitors to a page. For our example, we'll add a back to top link after each paragraph, as well as the anchor to which the back to top links will take us. To begin, we simply create the new elements:
$(() => { $('<a href="#top">back to top</a>'); $('<a id="top"></a>'); });
We've created a back to top link in the first line of code and a target anchor for the link in the second line. However, no back to top links appear on the page yet. ...
Read now
Unlock full access