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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:06:23+00:00 2026-06-13T00:06:23+00:00

see the jsfiddle here i’m trying to get the ‘read more’ links to slide

  • 0

see the jsfiddle here

i’m trying to get the ‘read more’ links to slide down and show the hidden content when clicked, but i can’t seem to get the click function registered correctly. did i do something obviously wrong?

basic html layout

<div id="wrapper">
    <div id="aHidden">some long text here</div> <!--defaulted hidden with css-->
    <div id="aBtn" class="bio-readMore">read more...</div>
</div>

here’s the jQuery i’m trying to use to do this:

$(document).ready(function() {
    $("div").each(function(idx) {
        if ($(this).hasClass('bio-readMore')) {
            var thename = this.id.replace("Btn", "Hidden");
            var sel = "#" + thename;
            $(sel).click(function() {
                alert("running click for element with value " + this.id);
                if ($(this).is(":hidden")) {
                    $(this).slideDown("slow");
                } else {
                    $(this).slideUp();
                }
            });
        }
    });
});​
  • 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-13T00:06:24+00:00Added an answer on June 13, 2026 at 12:06 am

    With your existing markup you could easily replace your click registration with the following:

    $(".bio-readMore").on("click", function(){
        $(this).prev().slideToggle();
    });
    

    ​jsfiddle example

    If you want to fix your code you have some of your selectors reversed:

    $(document).ready(function() {
        $("div").each(function(idx) {
            if ($(this).hasClass('bio-readMore')) {
                var thename = this.id.replace("Btn", "Hidden");
                var sel = "#" + thename;
                $(this).click(function() {  //<--- On the <a/> not the hidden element
                    alert("running click for element with value " + this.id);
                    if ($(sel).is(":hidden")) { // <----you want to check the hidden not the <a/>
                        $(sel).slideDown("slow");
                    } else {
                        $(sel).slideUp();
                    }
                });
            }
        });
    });​
    

    jsfiddle example

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

Sidebar

Related Questions

I have a drop down menu which you can see here on jsfiddle .
As you can see here: http://jsfiddle.net/kralco626/3BYDu/ The icon does not show up when you
please see the jsFiddle here: http://jsfiddle.net/xv9Wq/9/ What I'm trying to do is create a
If you see this JSFiddle here , I'm simply trying to animate in a
See here: http://jsfiddle.net/zYcJm/ The jQuery should be validating each field to check if they
I have two select boxes with dates. See here the jsfiddle: http://jsfiddle.net/egrba/ The people
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
You can see the example here: http://jsfiddle.net/8EHED/8/ This is a tricky problem because I
This is a fairly weird case, you can see the code here: http://jsfiddle.net/zpZtH/2/

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.