Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9032415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:58:38+00:00 2026-06-16T07:58:38+00:00

SUMMARY: I need to insert a Back to Top links after every <div class=wrapSection>.

  • 0

SUMMARY:

I need to insert a “Back to Top” links after every <div class=”wrapSection”>. I’ve been successful using the following:

<script>
$('.wrapSection').after('
    <div class="backToTop clearfix">
       <a href="#top" class="up">Back To Top </a>
    </div>
 ');
</script>

However, I want to use a smooth scroll when clicking ‘Back to Top.’ With that in mind, I tried the following:

<script>
$('.wrapSection').after('
<div class="backToTop clearfix">
    <a href="javascript:void(0)" onclick="goToByScroll('top')" class="up">
      Back To Top
    </a>
</div>
');
</script>

That does not work. Being a jQuery rookie, I did what seemed logical, which seems to never be the correct answer.

IN A NUTSHELL

More or less, I need this to appear, dynamically, after every <div class=”wrapSection”>:

<div class="backToTop">
    <a class="top" href="javascript:void(0)" onclick="goToByScroll('top')">
        Back to Top
    </a>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:58:40+00:00Added an answer on June 16, 2026 at 7:58 am

    This is the solution I came up with:

    ​$(document).ready(function() {
        // Markup to add each time - just give the element a class to attach an event to
        var top_html = '<div class="backToTop"><a href="#" class="top">Back To Top</a></div>';
        $(".wrapSection").after(top_html);
    
        // Use event delegation (see http://api.jquery.com/on/)
        $("body").on("click", ".top", function(e) {
            e.preventDefault();
            $("html,body").animate({ scrollTop: 0 }, "slow");
        });
    });​
    

    You can try a jsFiddle here: http://jsfiddle.net/F9pDw/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I insert into an Oracle DB Table using the following insert string (Approx --
A] Summary: Using get or insert functionality on one to many django models, checking
Summary: I need to collect data reliably from the satelite SQL servers using the
I need to change the following Bash code to Zsh TODO_OPTIONS=--timeout --summary cd ()
I have the following EditText preference <EditTextPreference android:key=pref_movies_min_year android:title=@string/pref_movies_min_year android:summary=@string/pref_movies_min_year_summary android:defaultValue=1950/> I need to
Executive summary: I need a way to determine whether a Windows process I've spawned
(Summary: My users need to be able to edit the structure of their dynamically
Summary: 1. Need to open a new window to display a survey from a
Summary I am after some advice on the easiest way to analyze simple data
Summary: the insert works. the cfc works the problem is when i add the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.