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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:31:25+00:00 2026-05-24T07:31:25+00:00

I have a simple show/hide jquery script that works fine on its own, The

  • 0

I have a simple show/hide jquery script that works fine on its own, The problem is that I am using it on the comments section off a php/mysql driven site.

I am struggling to pass the commment id variable to the jquery script so that the show/hide function works for each comment independently.

I am new to jquery and javascript, so thanks in advance for your explanations.

Javacript

<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){

    $('p.1').hide();    
    $('a.1').click(function(){

        $('a#read_more').hide(1700);
        $('p.1').slideDown(1500);   

        $('a#read_less').click(function(){

            $('p.1').slideUp(1500);
            $('a#read_more').show(1700);    

        });

    });         
});
</script>

HTML

<a href="#" class="1" id="read_more">Read More</a>
<p class="1" id="1">
LOREM IPSUM DOLOR SIT AMET, CONSECTETUER ADIPISCING ELIT, SED DIAM NONUMMY NIBH      UISMOD TINCIDUNT UT LAOREET DOLORE MAGNA ALIQUAM ERAT VOLUTPAT. UT WISI ENIM AD MINIM VENIAM, QUIS NOSTRUD EXERCI TATION ULLAMCORPER SUSCIPIT LOBORTIS NISL UT ALIQUIP EX EA COMMODO CONSEQUAT. DUIS AUTEM VEL EUM IRIURE DOLOR IN HENDRERIT IN VULPUTATE VELIT ESSE MOLESTIE CONSEQUAT, VEL ILLUM DOLORE EU FEUGIAT .<br />
    <a href="#" class="1" id="read_less">Read Less</a>
    </p>
  • 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-24T07:31:25+00:00Added an answer on May 24, 2026 at 7:31 am

    Would something like this work? It doesn’t get the id of the comment, but it specifically targets each comment individually.

    $(document).ready(function(){
        $('li.comment p.cText').hide();    
        $('li.comment a.read_more').click(function(){
    
            $(this).hide(1700);
            $(this).next("p").slideDown(1500);   
    
            $('li.comment a.read_less').click(function(){
    
                $(this).parent("p").slideUp(1500);
                $(this).parent("p").prev("a").show(1700);    
    
            });
    
        });         
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple hide show jquery script I grabbed from an example site.
Made a simple script that hide/show a hidden div. The page automatically adjusts its
I have a simple script to hide/show a table row. I'd like it to
I have a simple unordered list that I want to show and hide on
I have a simple file that has a Jquery script it in that looks
I have some very simple jQuery hide/show logic called on a change in select
I am working on a simple FAQ page that will show/hide answers on clicked
Here is my problem: The Problem I have created Tabs using jQuery which is
I have a simple javascript (JQuery based) method that does some css magic to
I have a jQuery script, which is filtering an html select list. It works

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.