DarkLink DarkLink - 3 months ago 29x
jQuery Question

HTML/jQuery - Make TextArea Behaviour like Command Line

I am trying to make a textarea look and behave like a command line, but I have one problem now..

Each time the user writes a command and presses 'Enter', I don't want the user to be able to write on lines above, but he can copy the content written before.

So the challenge is, how to limitate the lines where user can write?

Thanks alot in advance!


What if we disable going back up?



<textarea id="command-line"></textarea>


    if(e.keyCode === 38){
        return false;

JSFiddle: http://jsfiddle.net/RE9hk/4/

EDIT: flaw is the mouse which can be used to set the cursor, or have turned that off (in cmd (windows) it's not possible to use the mouse)