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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:53:33+00:00 2026-05-22T21:53:33+00:00

The following code is what I am using: jQuery: jQuery(‘#slickbox3242’).hide(); jQuery(‘#slickbox3243’).hide(); jQuery(‘#slickbox3244’).hide(); jQuery.fn.fadeToggle =

  • 0

The following code is what I am using:

jQuery:

jQuery('#slickbox3242').hide();
jQuery('#slickbox3243').hide();
jQuery('#slickbox3244').hide();

jQuery.fn.fadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

jQuery("a.slick-toggle").click(function () {
var id = jQuery(this).attr('id');
jQuery("#slickbox" + id).fadeToggle({
speed:200,easing : "swing"})

jQuery(this).text(jQuery(this).text() == 'Show Filters' ? 'Hide Filters' : 'Show Filters');
return false;
});

HTML:

<a href="#" id="3242" class="slick-toggle">Show Sales Org Filters</a>
<div id="slickbox3242" style="overflow:hidden;">Some Content</div>

<a href="#" id="3243" class="slick-toggle">Show Retail Filters</a>
<div id="slickbox3243" style="overflow:hidden;"> Some Content</div>

So what I need help with is how to change the text of the links after toggling. For example the initial state of the slickbox3243 is hidden and the text should be “Show Sales Org” and then when it is visible the text should be “Hide Sales Org”.

I have seen where span may be used, but I am new to jQuery, and I have yet to see how to set the text specific to the link being changed. I have up to 5 of these links!

  • 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-22T21:53:34+00:00Added an answer on May 22, 2026 at 9:53 pm

    index and relation attributes are helpful here:

    <a href="#" id="3242" rel='slick1' index=0 class="slick-toggle">Show Sales Org Filters</a>
    <div id="slickbox3242" class='content' rel='slick1' index=0 style="overflow:hidden;">Some Content</div>
    
    <a href="#" id="3243" rel='slick2' index=0 class="slick-toggle">Show Retail Filters</a>
    <div id="slickbox3243" class='content' rel='slick2' index=0 style="overflow:hidden;"> Some Content</div>
    

    jquery

     $("a.slick-toggle").click(function () {
         var rel = $(this).attr('rel');
         //get the text from the <a> and remove the 1st word
         var text = $(this).text().substr(5);
         $(".content[rel='" + rel + "']").fadeToggle({speed:200,easing : "swing"})
         //use the index attribute to determine if the link has been clicked or not
         if( $(this).attr('index') == 0 ){
             $(this).attr('index',1).text("Hide " + text );
         } else {
             $(this).attr('index',0).text("Show " + text );
         }
     });
    

    Now clicking on the link will toggle your content, then check to see what the index is. If the index is currently 0 then it changes it to 1 (indicating it has been clicked) and changes the text to “Hide [the rest of your text]” and the inverse is true too.

    On another note – to conserve space and time, only call the .hide() function once like this:

    $(".content").hide();
    

    or

    $("#slickbo3242,#slickbox3243").hide();
    

    although I prefer the 1st method, this way you don’t have to worry about adding more div identifiers into the .hide() function if you add more later on. Just make sure you add class=”content” within the new div

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

Sidebar

Related Questions

I am using the following jquery code: $(#top ul li.corner).mouseover(function(){ $(span.left-corner).addClass(left-corner-hover); $(span.right-corner).addClass(right-corner-hover); $(span.content).addClass(content-hover); }).mouseout(function(){
I am using jquery 1.3.2 and have the following code, $(document).ready(function () { $.ajax({
I am using jQuery autocomplete pluggin . I have the following code $().ready(function() {
I'm parsing a XML using jQuery with the following code: function appendNav(xml) { $(xml).find(Nav).each(function()
I am using jQuery Address Plugin and I have the following code. $.address.change(function(e) {
I have the following code to count and trigger some functions using jQuery: jQuery('#input_guideName').keyup(function(e)
I'm using jQuery to re-populate a DropDownListFor using the following code: $('#Teste).change(function () {
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Div box dimensions are measured using jQuery with following code: $(document).ready(function(){ var h =
I am retrieving results from twitter using jQuery using the following code: $(document).ready(function(){ var

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.