Press return to post chat posts- SHIFT-RETURN creates line break
on mobile devices keep default behavior
This commit is contained in:
parent
94d874c0b2
commit
30aeb42bed
@ -89,3 +89,20 @@ function update_chats(chats) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
function isMobile() {
|
||||||
|
try{ document.createEvent("TouchEvent"); return true; }
|
||||||
|
catch(e){ return false; }
|
||||||
|
}
|
||||||
|
$(function(){
|
||||||
|
|
||||||
|
$('#chatText').keypress(function(e){
|
||||||
|
if (e.keyCode == 13 && e.shiftKey||isMobile()) {
|
||||||
|
}
|
||||||
|
else if (e.keyCode == 13) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).parent('form').trigger('submit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
Reference in New Issue
Block a user