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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:58:58+00:00 2026-05-30T07:58:58+00:00

I am trying to generate a html code block when I click on a

  • 0

I am trying to generate a html code block when I click on a link. I have the same link “Reply” several times on the page. But I want to generate the code under the clicked link. I tried using $(this) but it did not work. Thanks for your help! If there is a better solution, please let me know. Also for reference, I am trying to create a reply textarea just like on Youtube when you click on the reply link it opens a textarea for the user to input text.

The sample code is available here Sample Code

  • 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-30T07:58:59+00:00Added an answer on May 30, 2026 at 7:58 am

    Demo

    $(".reply").one('click', function (event) {
        var html = "<div class='alpha grid_11 underVideo'><ul><li><textarea class='roundedCorners textAreaLabel' rows='4' cols='100' wrap='off' placeholder='Respond to this video...' name='CommentTextArea'></textarea></li></ul></div>";
        $(this).parent().after(html);
        return false;
    });
    

    Since there was a class .reply on the target element, I used that instead of .normalText a:last-child.

    Instead of binding ‘click’ to the element, .one is used. Using .one will only fire once which will prevent adding multiple textareas.

    $(this) refers to the element clicked which in this case is the a.reply element. Using .parent() will travel up the DOM and select the parent which is a span. And of course, .after(html) inserts the html after the span.

    return false; does both .preventDefault(); .stopPropagation();

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

Sidebar

Related Questions

As I mentioned here , I'm trying to generate HTML from an ASPX page
I am trying to generate a html page with css that works as an
I am trying to generate a dynamic html button in c#,But buttons are being
I'm trying to generate a JSON response that includes some HTML. Thus, I have
I am trying to generate a specific link and accompanying html depednant on the
I'm trying to generate a table of contents from a block of HTML (not
I have a generated HTML page with flash content in it. I am trying
I have this php code, with which I am trying to generate a popup
I'm trying to generate some HTML content for a google maps infowindow. I have
I am trying to generate some HTML code to list some images for a

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.