Merge pull request #71 from beatriceo/send-enter
added an event listener on enter key to have it as send
This commit is contained in:
commit
ab42239aad
|
@ -100,3 +100,4 @@ if (acceptButton) {
|
|||
document.getElementById('chat-room-id').value = chatRoomId
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -220,3 +220,18 @@ setTimeout(function() {
|
|||
window.__proto__.reload = () => { window.location = window.location }
|
||||
})();
|
||||
|
||||
|
||||
// // have enter with JS
|
||||
// const form = document.getElementById("chat-form")
|
||||
// document.getElementById("chat-input").addEventListener("keyup", event => {
|
||||
// if(event == "Enter"){
|
||||
// form.submit();
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
document.getElementById("chat-form").addEventListener("click", function(event){
|
||||
event.preventDefault()
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -28,14 +28,16 @@
|
|||
<option value="<%= language.code %>"><%= language.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
<span class="input-group-addon" style="width:0px; padding-left:0px; padding-right:0px; border:none;"></span>
|
||||
<input type="text" class="form-control" name="chat-input" id="chat-input" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary form-control" id="send-btn" type="submit" remote: true>Send</button>
|
||||
</span>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-danger form-control" id="original-btn" type="submit" remote: true>Show Original</button>
|
||||
</span>
|
||||
<form class="form-inline" id="chat-form">
|
||||
<span class="input-group-addon" style="width:0px; padding-left:0px; padding-right:0px; border:none;"></span>
|
||||
<input type="text" class="form-control" name="chat-input" id="chat-input" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary form-control" id="send-btn" type="submit" remote: true>Send</button>
|
||||
</span>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-danger form-control" id="original-btn" type="submit" remote: true>Show Original</button>
|
||||
</span>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue