Get help. Give help. A Web Design and Development Community.

Pulling text out of a P tag and putting it into a text area

  • # April 12, 2010 at 5:27 pm

    Okay, just used Chris’ snippet on making a div clickable. Now, I would like to take the text in my p tag and place it in a text area on my page. For example, here is my jQuery:

    window.location =$(this).find(‘p.answer’);


    Now, I want to take whatever is in a paragraph tag with the class of answer and place it into my text area. Is there a way to do this? I’m a jQuery noob, but I know I could do something like this using AJAX and .NET.

    # April 12, 2010 at 7:59 pm

    I think this should do it. The p tag at the beginning is the paragraph you want to target and inside the append is the opening and closing tags of your text area that you want to target. Tell me how it goes.

    # April 13, 2010 at 9:32 am

    So, I tried that and nothing came of it. Here is the code I have now:

    window.location = $(this).find(“p”).text();

    What happens when you click on this you get a 404 error. I tried it with out the second line, but then nothing happens on the site.

    # April 13, 2010 at 10:03 am

    This reply has been reported for inappropriate content.

    Not sure why you are using window.location unless you are looking to reload the page rather than place some content in a textarea

    Anyway….JQuery is not my strongest point but probably would be something like this (might be wrong though)

    //Not sure if textarea below needs quotation marks, maybe just give it an ID instead
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.