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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:49:04+00:00 2026-05-29T19:49:04+00:00

I am currently using the below text as a simple way of hiding and

  • 0

I am currently using the below text as a simple way of hiding and displaying my text. What I was trying to do though also was use the css to display the a tag with a background image:

one to have a plus symbol for when the text is hidden.

Then one to have a minus symbol for when the text is displayed and you want to hide the text again.


JavaScript:

function toggle() {
    var ele = document.getElementById("toggleText");
    var text = document.getElementById("displayText");
    if(ele.style.display == "block") {
        ele.style.display = "none";
        text.innerHTML = "Show";
    }
    else {
        ele.style.display = "block";
        text.innerHTML = "Hide";    
    }
} 

HTML:

<a id="displayText" href="javascript:toggle();">Show Further Details & Specification</a>
<div id="toggleText" style="display: none"><h1>peek-a-boo</h1></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-05-29T19:49:05+00:00Added an answer on May 29, 2026 at 7:49 pm

    You need to set up the CSS for “displayText” to give it a background.

    Something like this:

    #displayText {
        display:block;
        height:20px;
        padding-left:30px;
        background-image:url(../images/plus.png);
    }
    

    Then swap the image for the alternate state:

    #displayText.active {
        background-image:url(../images/minus.png);
    }
    

    So in your code you’ll need to add/remove the “active” class name on displayText based on the toggle state.

    P.S. It’s considered bad form to used “href” for JS events. It’s better to use onclick.

    <a id="displayText" href="javascript://"  onclick="toggle();">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to develop a simple plugin for visual studio 2008 using
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I'm currently using the TextBlock below to bind the value of a property named
Currently I am calling a title from the database using the below code it
I'm using the popular JQuery Autocomplete plugin below. http://jqueryui.com/demos/autocomplete/ Currently if you type a
Im trying to generate a color gradient using ColdFusion. My current code below works
I am creating a simple drop down menu using css. <ul> <li id=base><a href=projects.php
I'm currently using below method to call an external php file with some variables
I am currently looking for a way to search though a MembershipUserCollection. At the
Below is a simple example using gtk2hs that adds a label and then a

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.