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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:32:49+00:00 2026-05-30T05:32:49+00:00

I have a show/hide Jquery function in place on a multi-entry page which toggles

  • 0

I have a show/hide Jquery function in place on a multi-entry page which toggles the visibility of extended content for each entry. It works nicely, however, when a “more” link is clicked it toggles the extended content for all entries simultaneously. I’m hoping to adjust the Jquery function to target each entry individually.

I thought the best way to achieve this would to have the Jquery function target EE’s unique {entry_id} parameter as part of the click event but I’m still struggling to figure out the syntax / implementation of using EE template tags in tandem with Jquery. I am very much a Jquery beginner. Can anyone advise?

The Jquery in place is as follows:

function showMore(){

$('.more').hide();

$('.morelink a').click(function(e) {
$('.more').slideToggle('slow');
$('.morelink a').toggleClass("less");
$(this).text($(this).text() == 'Less' ? 'More' : 'Less');
e.preventDefault();
});
}

$(document).ready(function(){
showMore();
}); 

This looks for the click of a text link (.morelink a) and slidetoggles a hidden div (.more) while also togglgling the text of said link from “More” to “Less” depending on the state. Note that this function is located in a separate template which gets embedded on page load.

The stripped-down html in question is simply:

{exp:channel:entries channel=“x” limit"x"}

<div class=“content”>content</div>
<div class="more">more content</div>
<div class="morelink"><a href="#">More</a></div>

{/exp:channel:entries} 

I’ve tried every permutation and arrangement I can think of to get {entry_id} recognized but to no avail. Not sure if it’s a parse-order problem, a syntax problem, or if this method is just misguided. Any and all guidance is GREATLY appreciated.

  • 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-30T05:32:51+00:00Added an answer on May 30, 2026 at 5:32 am

    You don’t need to tie your jQuery in with EE’s {entry_id} for this.

    Wrap each content block so it looks like this:

    {exp:channel:entries channel=“x” limit"x"}
        <div class="content_block">
            <div class=“content”>content</div>
            <div class="more">more content</div>
            <div class="morelink"><a href="#">More</a></div>
        </div>
    {/exp:channel:entries} 
    

    Then change your jQuery to this:

    function showMore() {
        $('.more').hide();
    
        $('.morelink a').click(function(e) {
            var block = $(this).parents('.content_block');
            block.find('.more').slideToggle('slow');
            block.find('.morelink a').toggleClass("less");
            $(this).text($(this).text() == 'Less' ? 'More' : 'Less');
            e.preventDefault();
        });
    }
    
    $(document).ready(function(){
        showMore();
    }); 
    

    Now, each time a link is clicked it will reference only the elements within its local content_block DIV.

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

Sidebar

Related Questions

I have this jquery script which suppose to hide/show div element base on the
I am encountering an odd behavior using jQuery to show/hide a menu. I have
I have some DIVs that I am using JQuery to hide and show using
I have a nested function to show/hide paragraphs news-ticker-style. The problem is that when
I have a button on click of which i want to either show/hide a
I have a JQuery function that toggles one of the divs in my layout.
I have a LoadingStatus Function that has two options SHOW or HIDE. The Show
I have a sliding div on my page which is using jQuery, I'd like
I have a simple show/hide jquery script that works fine on its own, The
I have a show/hide toggle working well in multiple instances (thanks to help here

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.