Javascript Shift+Enter (Firefox)
- by Stephen MCGinley
Hi guys,
Had a look and found some things on this, but nothing seems to work as I'd like it.
Initially I had my solution working with internet explorer and chrome, but not firefox (which is unsatisfactory for me to not have working)
What I'm looking for is a simple text area, which sends data on enter key, but creates a new line on Shift+Enter. The following is what I have
function goReturn(e,str) {
var e = (window.Event) ? e.which : e.keyCode;
if (e.shiftKey && e=="13") {
document.getElementById("wall").value =
document.getElementById("wall").value+"\n";
} else if(e=="13"){
// ...continue to send data
}
}
This sends the data on enter, but also sends the data on shift and enter (which is the problem I have).
Thanks for any assistance