Trouble with script to handle spillover from one form input to the next

I’m running a forum where users start entering text into a text input, and when they reach the database field’s length, jscript automatically switches focus to a textarea where they can continue typing.

The script I use tries to break the text input at the nearest whole word and move the next word to the textarea. Sometimes, users who type really fast complain that as they type, their text appears before the word that was moved over. I’m sure it has something to do with the keyboard buffering and timing of the event handling but not sure how to improve this.

Any help is much appreciated!

$('#subject').keyup(function(){
	var subj = $(this).val();
        var id = $(this).attr('id');
        var ta = $('#message');
       	var maxlength = 180;
	if (subj.length >= maxlength) {
            $(ta).focus();
	    var re = /(.*)\\s(.*)$/;
	    var grp = re.exec(subj.substr(0,maxlength));
	    if(grp == null) {
			$(this).val(subj.substr(0,maxlength));
			$(ta).val(subj.slice(maxlength) + $(ta).val());
	    } else {
			$(this).val(grp[1]);
			$(ta).val(grp[2] + subj.slice(maxlength) + $(ta).val());
	    }
	}
});