评论框适用于<textarea>
,但我需要使用div
代替它。
这是文本区域代码:
<textarea class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" onblur="if (this.value=='') this.value = 'Write a comment'" onfocus="if (this.value=='Write a comment') this.value = ''" onKeyPress="return SubmitComment(this,event)" wrap="hard" name="commentMark" style=" background-color:#fff; overflow: hidden;" cols="60">Write a comment</textarea>
我尝试将其替换为contenteditable
div
<div class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" onblur="if (this.value=='') this.value = 'Write a comment'" onfocus="if (this.value=='Write a comment') this.value = ''" onKeyPress="return SubmitComment(this,event)" wrap="hard" name="commentMark" style=" background-color:#fff; overflow: hidden;" cols="60">Write a comment</div>
但是在文本区域,当我按下输入评论被发布。当我输入div时,它没有任何效果。
单击“评论”按钮时出现