Javascript, writing dynamic content to textarea -


i programming blog in php, record i've started out im doing pretty php javascript don't understand.

on blog people comment , discuss.

what want:

every comment has id displayed.

i want click on , javascript should place in textarea leaving comments.

thats all.

(this answer uses jquery.)

// getting reference textarea element var $ta = $("#new_comment textarea");  $(".comment").click(function() {     var text = $(this).find(".text").text(); // depends of structure     $ta.val(text); }); 

<div class="comment">     <p class="author"> peter </p>     <p class="text"> article! </p> </div> 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -