Quote comments

Actually, the subject, how to implement quoting a specific answer?

as I understand it, you need to pull out the line of one of the answers / comments and insert it into the textarea, the question of the implementation of this miracle. google 2 pages did not help(

I can imagine the logic, but I don’t understand how to implement it. if I made a mistake with labels, I suppose that it can be implemented in all 3 ways.

UPD

<table width="100%" border=0>
    <tr>
        <td width="5"><img src="/img/spacer.gif" width="5" height="58" border="0"></td>
        <td background="/img/spacer.gif" class="ctitle" valign="top" colspan="2">
        #<?echo $n ?> : <? echo $res['autor']; ?> (<? echo $date; ?>)</td>
        <td width="5"><img src="/img/spacer.gif" width="5" height="58" border="0"></td>
    </tr>
    <tr>
        <td background="/img/spacer.gif"><img src="/img/spacer.gif" width="5" border="0"></td>
        <td valign="top" colspan="2">
<table width="100%">
    <tr>
        <td width="140" valign="top" border=1 style="color: #717171;font-size: 11px;font-family: tahoma;"><img src="" border="0" /><br />
        <img width="100" height="20" src="<?echo $usergroupico;?>" /><br /><br />: <? echo $usergroup; ?><br />: </td>
        <td class="your_comment_container" valign="top"><? echo $res['message']; ?><br /><br />
        --------------------<br /><div style="color: #717171;font-size: 11px;font-family: tahoma;"><? echo $signature; ?></div>
        </td>
    </tr>
</table>
        </td>
        <td background="/img/spacer.gif"><img src="/img/spacer.gif" width="5" border="0"></td>
    </tr>
    <tr>
        <td><img src="/img/spacer.gif" width="5" height="32" border="0"></td>
        <td background="/img/spacer.gif" style="color: #717171;font-size: 11px;font-family: tahoma;" align="left">
        ICQ: </td>
        <td background="/img/spacer.gif" style="color: #717171;font-size: 11px;font-family: tahoma;" align="right">
        <a href="" class="quote_btn"></a> <a href=""></a> 
        <a href=""></a></td>
        <td><img src="/img/spacer.gif" width="5" height="32" border="0"></td>
    </tr>
</table>
<?} ?>
<h2> </h2>
<?
if(!$_POST['newreply']) {
echo '
<div class="form">
         <form method="post" class="niceform">
                <fieldset>
                    <dl>
                        <dt><label for="comments">:</label></dt>
                        <dd>
                        <textarea name="newreply" id="my_comment_field" rows="15" cols="43"></textarea></dd>
                    </dl>
                    <dl class="submit">
                    <input type="submit" name="submit" id="submit" value="" />
                     </dl>
                </fieldset>
         </form>
</div>
'; 
} else {
 if (!get_magic_quotes_gpc()) {
$newreply = addslashes($_POST['newreply']); } else {
$newreply = ($_POST['newreply']); }
     @$link = mysql_connect("$hostr", "$userr", "$passwordr");
   if (!$link) {
      die('  : ' . mysql_error());
   }
    mysql_select_db($dbr);
    mysql_query("SET NAMES 'utf8'");
mysql_query ("set character_set_client='utf8'");
mysql_query ("set character_set_results='utf8'");
mysql_query ("set collation_connection='utf8_unicode_ci'");
$data = date("Y-m-d");
$q = "insert into `proj_detail` (catId, autor, access, message, date) values
   ('$_GET[id]','$_SESSION[login]','$_SESSION[access]','$newreply','$data')";
   $r = mysql_query($q);
   if (!$r) { echo "MySQL error: " . mysql_error()."!"; } else { echo " ";}
   echo '<br><a href="index.php?module=projdetail&id='.$_GET['id'].'"> </a>';
}

Responsible for displaying messages and adding a piece of code


Answer 1, authority 100%

Example with jQuery:

<div>
<div class="your_comment_container">
     
</div>
<div class="quote_btn"></div>
</div>
<textarea id="my_comment_field">
</textarea>
<script>
$(document).ready(function(){
$(".quote_btn").click(function(){
var text_to_quote = $(this).parent().children("div.your_comment_container").html();
$("#my_comment_field").val(text_to_quote)
});
});
</script>

Answer 2, authority 100%

Actually, you need to catch the selected text and that’s it, right? If so, then dig into the jquery docks, I’m sure there must be something there!
And if you just want to add the content of the comment to the form by clicking on the button next to the comment, then it’s as easy as shelling pears, selectors will help you! If you don’t understand, I’ll give you a schematic code.