3 o'clock javascript

I was writing some code to react at a textarea.onKeyUp. I take the size of the current textarea.val().length, update an element and do some other stuff. yawn The first version of the code looked like: 1 2 3 4 $('#message').keyup(function(e){ $('#chars_num').html( new_len ); $('#sms_num').html( Math.floor($('#message').val().length / 161) +1) ); }); Working good, but was clearly slow: every keystroke was “giving back the cursor” too slowly for a fast typer like me. I went to take a look at twitter, and their text box was WAY FASTER. ...

March 28, 2010 · 1 min · 201 words