这是我的消息传递代码,它包含div部分,用于显示表单部分包含的消息
输入标签和发送按钮以键入和发送消息,如何在该div部分显示消息
不使用发送按钮
<div class="direct-chat-msg">
<div class="">
<span class="direct-chat-name float-left">
</span> <span class="direct-chat-timestamp float-right"> 2:37 pm</span>
</div>
<img class="" src="#"alt="message user image">
<table id="conversation" >
<tr>
<tr>
</tr>
</table>
</div>
<form action="#" method="post">
<div class="input-group">
<input type="text" id="name" placeholder="Type Message ..."class="form-control">
<span class="input-group-append">
<button id="send" type="submit" onclick="myFunction()" class="btn btn-primary">Send</button>
</div>
通过使用以下能够启用消息的javaScript iam
<script>
function myFunction() {
var table = document.getElementById("conversation");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
cell1.innerHTML ='<div class="direct-chat-text" id="greetings"></div>' ;
}
</script>
But how to enable this without using send button i tried using triggering onclick Enter