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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:14:16+00:00 2026-05-24T05:14:16+00:00

I am making a comments system and each comments textarea gets a unique class.

  • 0

I am making a comments system and each comments textarea gets a unique class.
My code-

$(".ccoomm").click(function() {
var pid = $(this).attr("id");
var tt = $("textarea ."+pid).val();
var email = $("#hidden").val();
var data = "pid=" + pid + "&text=" + tt + "&email=" + email;
$("#flash").show();
$("#flash").fadeIn(500).html('<img src="wamp.gif" /> Loading...');
$.ajax({
    type: "POST",
    url: "comments.php",
    data: data,
    cache: false,
    success: function(html) {
        $(".coments"+pid).append(html);
        $("#flash").fadeOut(100);
        $("#tt").val("");
        $(".comments"+pid).slideToggle(100);
        $(this).toggleClass("active");
    }
});

});

I am unable to get the textarea value…. It says “undefined”

The html/php-

echo <li><textarea cols='20' rows='1' class='tt' id='".$comid."' placeholder='Comment..'/></textarea><input type='submit' value='Comment' id='ccoomm' class='".$comid."' /></li>";
    echo "</ul>";
  • 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-24T05:14:17+00:00Added an answer on May 24, 2026 at 5:14 am

    Not sure but are you expecting to add an id after textarea in your value selection?

    Right now, it looks like you are selecting a class.

    var pid = $(this).attr("id");
    var tt = $("textarea ."+pid).val();
    

    If you want the id change the second line to

    var tt = $("textarea#"+pid).val();
    

    EDIT

    Looking at the HTML you supplied in the edit, you could change the line to

    var tt = $("textarea.tt").val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find myself making repetitive mistakes typing keywords and sentences in my code comments.
I am making a comments system in which i can accept user input with
I'm part-way through making a simple comments system with PHP. With every comment that
I have been making a threaded comment system as a way to learn php
Are these nested comments allowed in a XML file? <!-- Making only one observation
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
Following the recommendations in system generated comments of an AssemblyInfo.cs file: // Version information
Say you're making a blog software, and want to show the number of comments
For example, I have a model Posts and Comments. Post.objects.annotate(Count('comment')) I am making such
I'm making a little open source mp3 player for people to see the code,

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.