使用 jquery 插入“输入按键”

Insert 'Enter Keypress' using jquery

本文关键字:输入按键 输入 jquery 插入 使用      更新时间:2023-09-26

>我有一个引用函数,当用户单击该文本的"QUOTE"时(例如:"这是我的文本"),在我的文本区域中将显示">这是我的文本"。 用户可以在该文本下方添加他们的文本。目前,在我引用之后,然后单击文本区域,我的光标在新行上,但是当我添加文本区域时,我的报价文本和文本输入在一行中

在这里我的网页

<span style='float:left' id="topmod"></span><br/>
<textarea class="text ui-widget-content ui-corner-all" name='modrepmsg' id='modrepmsg' cols='100' rows='8' tabindex='1004'></textarea><br/>
<br/>
<span id="modquote" style="float:left;text-decoration:underline;">QUOTE</span>
<input type="hidden" name="repmsg" id="repmsg" />
<span id="modadd" class="button_form" style="cursor:pointer;"><?php echo $lang['REQUEST_ADD_B']; ?></span>

这是我的Jquery报价

$( '#modquote')
  .click(function() {
    var comment = $('#repmsg').val();
    var quote = ">" + comment + "'n";
    $('textarea#modrepmsg').html(quote);
});

这是我的 jquery 保存

    $( '#modadd')
  .click(function() {
    var repmsg = $('#modrepmsg').val();
    window.location = 'reply_msg.php?msg=' + repmsg;
});

在我的reply_mg.php中,我请求味精$msg = $_REQUEST['msg'];

请帮助我。谢谢。

托盘这个:

$('#textbox').keypress(function (e) {
   if (e.keyCode == 13) { // get Enter key
      // your code here
   }
});