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

  • SEARCH
  • Home
  • 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 7054895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:40:57+00:00 2026-05-28T03:40:57+00:00

I have the following code which when used in a link goes forward to

  • 0

I have the following code which when used in a link goes forward to the next link … so I’m basically using it to do the function of a next button.

What I need to do is to create a reverse version so I can use it as a Back button.

Here is the code:

<script>
    $("a.mytrigger").click(function(e){  
        var index = $(this).attr("href").substr(5);  
        $('#navigation li:nth-child('+parseInt(index)+') a').click();  
        e.preventDefault();  
    });                         
</script>

UPDATE:

Please see the link below for further details:

Javascript JQuery Script click link by code (Sliding Form Script)

  • 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-05-28T03:40:58+00:00Added an answer on May 28, 2026 at 3:40 am

    I think your problem can be solved more easily, with less HTML.
    have a look at my fiddle.

    A little explanation :

    1. I am creating links onload usig $(function()) method. I find all the “li” items, and I am adding “next”,”prev” links on them. At the end I remove the “prev” link from the first item and the “next” link from the last item. This way I don’t need to constantly create HTML elements on my own.
    2. Each link I add, I identify with a class “next” or “prev”.
    3. I bind with “live” ( you might need to use “on” instead . the syntax might be a bit different)

      with the “live” method I attach “click” event on each link. the handler operates on each link according to its “next”/”prev” class I attached from before.
      For the “next” class, I use the “next” function in JQuery to get the next “li” element.
      For the “prev” class, I use the “prev” function in JQuery to get the previous “li” element.

      Please note that before I invoke “prev” or “next” functions, I make sure I reference the “li” object which is wrapping the link. For that I use the “closest(‘li’)” call on $(this)

      Let me know if there’s anything more you need.

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

Sidebar

Related Questions

I have the following JavaScript code: Link In which the function makewindows does not
I have the following code which is used to slidein/out a div (shopping basket)
I have the following JavaScript code which is inside a function which I am
I am modifying a javascript file in which they have used the following code.
I'm trying to use opengl in C#. I have following code which fails with
I have following Code Block Which I tried to optimize in the Optimized section
I have the following code which works just fine when the method is POST,
I have the following code which works fine. However, I only want to return
I have the following code which should put programs startable in Bash. if [
I have the following code which reads in the follow file, append a \r\n

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.