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
Post a Comment