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 8139091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:42:34+00:00 2026-06-06T11:42:34+00:00

I have some js (show/hide pretty standard I guess): <script> function showTransactions(transactions){ $(‘.steps’).hide() $(‘#’

  • 0

I have some js (show/hide pretty standard I guess):

<script>
    function showTransactions(transactions){
        $('.steps').hide()
        $('#' + transactions).show();
    }
</script>

and some html:

<p><a href="#"onClick="showTransactions('hidden3');return false;">Edit</a></p>
<div id="hidden3" class="steps" style="display: none;">

Now this works great when I click the link, it shows it. Easy. How can I get the js to refresh to the current step? I have steps hidden1, hidden2, hidden3, and hidden4. The default starting position is hidden1 so on refresh it will display hidden1 instead of hidden3 if that’s where you were on refresh.

Also, I need to direct users to a specific step on some instances via a url link. I tried page_url#hidden4 but that doesn’t work. I need to be able to tell it to display hidden4 in that link instead of the default first step.

  • 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-06T11:42:36+00:00Added an answer on June 6, 2026 at 11:42 am

    Two main things are wrong with your code:

    • You do not hook your jQuery code to the “document ready” event. Not doing this will (potentially) cause it to run before the document is fully loaded, which is undesirable most of the time.
    • You’re using onclick inline JavaScript. Don’t do that. That’s not the way JavaScript/HTML integration is written anymore. jQuery has event handlers to catch click events for you. Always keep HTML and JavaScript 100% separate.

    CSS:

    .hidden {
      display: none;
    }
    

    HTML

    <p><a class="reveal" href="#hidden3">Edit</a></p>
    <div id="hidden3" class="hidden step">
    

    JavaScript

    // $() is short for $(document).ready()
    $(function () {
        // hide all the steps on document load
        $("div.step").addClass("hidden");
    
        // show the one step that is identified by the current hash (if any)
        $(document.location.hash).removeClass("hidden");
    
        $("a.reveal").click(function (event) {
            var idToReveal = $(this).attr("href");
    
            // store the ID to show in the URL for bookmarking
            document.location.hash = idToReveal;
    
            // hide every step that is currently visible
            $("div.step").not(".hidden").addClass("hidden");
    
            // reveal the next div (as identified by the current link's href)
            $(idToReveal).removeClass("hidden");
    
            // prevent the default click behavior (i.e. prevent navigation)
            event.preventDefault();
        });
    });
    

    The above makes use of the fact that the document.location.hash, a page-internal <a href> and jQuery’s ID selector all use the same syntax.

    As long as you just want to transport a single bit of information in the hash, this is all you need.

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

Sidebar

Related Questions

I have created some functional categories that I use to show/hide markup elements. However,
I have some DIVs that I am using JQuery to hide and show using
I have 3 radio buttons which hide/show some div's. The radio buttons are getting
I have a DLL containing some methods (show, hide and validate). Here is an
I have some divs that I show/hide. I want to reset the forms inside
I have some content that I am show/hiding using the Jquery toggle function. I
I have a form with some show/hide sections. When I press some buttons in
I have some simple jQuery toggle script like this: <script type=text/javascript> $(document).ready(function() { $('#clickedit').click(function()
<script> $(document).ready(function () { // for some reason the button hide has to be
Basically I have some CheckBox controls I want to use to show or hide

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.