Hi,

> <textarea id="mytext">
> -1
> -2
> -3
> </textarea

I guess, it is just my lack of imagination why someone could whant to need 
such a UI. At first I suggest, that you step back and have some thoughts if 
there really is not a better uI for what you need.

Anyway, To get what I think you need you could try something like this:

$('#mytext').keydown(function(ev) {
        if( ev.keyCode == 13 ) {
                var self = $(this);
                self.text(self.text().replace(/^([^-][^ ])/g,'- $1'));
        }
});

Not tested, but this should check for each keystroke if it was a newline. If 
it was, it should insert a '- ' at the begining of all Lines that don't 
already have it.

> My problem is how i break a line in textarea (i try a lot things and dont
> work)

?? It yould simply work by inserting a '\n' at the appropriate place in the 
Textarea.

Christof

Reply via email to