سؤال

I am working on a page that accepts entry into a single textarea, then splits the contained text across two output textareas in realtime should it reach a certain character limit (the first with 0 - x characters, the second with x - end). I have the copying process working, but am at a loss on how to approach the division and have the first textbox stop accepting input while continuing real-time entry on the second one.

هل كانت مفيدة؟

المحلول

You could move the cursor between textboxes by using.

$('newTextBox').focus();

For the charater limit, use this.

<textarea maxlength="50">

</textarea> 

Note that it doesn't work on Internet Explorer 9 and earlier versions, or in Opera.

نصائح أخرى

I think you should be able to call .focus() on the second box to force the cursor into it

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top