Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <script>
  2. var timer;
  3. $('#text').keypress(function (e) {
  4. var self = this;
  5. var code = e.keyCode || e.which;
  6. if (code == 13) {
  7. event.preventDefault();
  8. clearTimeout(timer);
  9. text = $('#text').val();
  10. $('#text').val('');
  11. timer = setTimeout(function(){
  12. socket.emit('text', { msg: text, room: '{{channel.channelLoc}}' });
  13. },2000)
  14. }
  15. });
  16. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement