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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:24:55+00:00 2026-05-11T16:24:55+00:00

A while ago I had asked how to make a collapsible comment box like

  • 0

A while ago I had asked how to make a collapsible comment box like Stackoverflow

The original question is found here

However since then I came across another problem which I am not entirely sure how to go about solving, I am pretty sure that I go about it the same way as the original question but, not quite sure of the syntax.

Basically what my problem is, is that I added a function to limit the # of characters the user enters into the comment and I show the characters remaining.

However because there can be many comment boxes in the list the script is only being executed for the first one in the list, and I need to to be dynamic.

In otherwords just like the links that open the comment box in my original question, each one has a unique id.

How do I do the same for the script that monitors the character input.

$(function(){
    $('#comment').keyup(function(){
        limitChars('comment', 255, 'charlimitinfo');
    })
});

Update: I did get them to be dynamic by doing something like this

$(function(){

    $('.comment-<%=ViewData.Model.Entry.EntryID %>').keyup(function(){
        limitChars('comment-<%=ViewData.Model.Entry.EntryID %>', 255, 'charlimitinfo');
    })
});

However when you open one and then open another the second one takes control…

  • 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-11T16:24:55+00:00Added an answer on May 11, 2026 at 4:24 pm

    To my idea your comment boxes are added dynamically. The problem is that since you have multiples ones that won’t work because an id is unique so it only applies to one, so instead of selecting them by id as you have, you can just set the class as “comment” in the control tags and select them that way. ex:

      $(function(){
       $('.comment').keyup(function(){
        limitChars('comment', 255, 'charlimitinfo');
       })
    });
    

    your text tag example:

      <textarea cols="20" rows="10" class="comment"></textarea>
    

    Edit The way that can work is keep your jquery set the way it is for the condition, but each tag have to have a unique name to it, either add something to the class to make it unique, but so the jquery will still know it falls under the selector branch or append a different number to each id tag

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try the following return typeof(MyClass).Name; Or also return MethodBase.GetCurrentMethod().DeclaringType.Name; May 12, 2026 at 12:54 am
  • Editorial Team
    Editorial Team added an answer You should be able to fake this by using a… May 12, 2026 at 12:54 am
  • Editorial Team
    Editorial Team added an answer the TCP binding uses the binary message encoder by default,… May 12, 2026 at 12:54 am

Related Questions

A while ago, I had a discussion with a colleague about how to insert
I had asked some questions about developing an online judge sometime ago on stackoverflow
A while ago I had a query that I ran quite a lot for
i remember a while ago i used a method like this to print out

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.