javascript - Shift + Enter » Multiple Line -


firstly english isn't native language, sorry if have mistakes.

there message sending problem in function, i've played jquery codes couldn't fix it.

when press enter, message reach receiver, that's good. when press shift enter, message reach receiver again, want create new line when press both keys.

jquery codes:

$(document).ready(function() {  	$('input#chat').bind('keydown', function(e) {  		if(e.keycode==13) {  			// store message var  			var message = $('input#chat').val();  			var id = $('#chat').attr('class');  			if(message) {  				// remove chat errors if  				$('.chat-error').remove();  				  				// show progress animation  				$('.message-loader').show();  				  				// reset chat input area			  				document.getelementbyid("chat").style.height = "25px";  				$('input#chat').val('');

did try ?

 if(e.shiftkey && e.keycode==13){      // don't fill  } else if(e.keycode==13){      e.preventdefault();      // store message var         var message = $('input#chat').val();         var id = $('#chat').attr('class');         if(message) {         ........................  } 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -