The main problem is that you add another keydown
event handler each time focusin
fires. Try this:
$('textarea').live("keydown", function(e){
var code = e.which;
if(code === 13) {
var prevIndex = parseInt($('#linenumbers li:last').text());
$('#linenumbers').append('<li>' + prevIndex++ + '</li>');
}
});
karim79
2010-05-13 22:42:23