2

id="mytextarea"テキストエリアを持つ新しいビューが表示されたときに、カーソルをテキストエリアに設定したいと思います。

.focus() が機能するはずですが、機能しません。なんで?

console.log('this message is displayed');//displayed in console
Ext.getCmp('mytextarea').focus();//nothing happens at the same time

そして、これは私がChromeに持っているものです:

<div class="x-container x-field-textarea x-field x-label-align-left x-form-label-nowrap x-empty" id="mytextarea">
    <div class="x-form-label" id="ext-element-127" style="width: 30% !important;">
        <span id="ext-element-128"></span>
    </div>
    <div class="x-component-outer" id="ext-element-126">
        <div class="x-unsized x-field-input sencha-clear-icon" id="ext-textareainput-1">
            <textarea id="ext-element-129" class="x-input-el x-form-field x-input-text" type="text" autocapitalize="off" placeholder="Type here...">
            </textarea>
            <div class="x-field-mask" id="ext-element-130" style="display: none !important;">
            </div>
            <div class="x-clear-icon" id="ext-element-131">
            </div>
        </div>
    </div>
</div>

ありがとうございました。

4

1 に答える 1

0

カーソルをテキサエリアの最後に移動する必要があります。SenchaTouch 2.3.0 / iOS を使用してください。テキストフィールドにフォーカスを設定し、新しい値を設定しました。ポップアップを開くと、テキストフィールドがフォーカスされ、キャレット位置がテキストの最後になります。

var textarea = document.getElementById('note'),
    note = textarea.getValue();

textarea.focus(); 
textarea.setValue('');//without this nothing happend 
textarea.setValue(note);
于 2014-02-04T19:43:20.810 に答える