我想在id="mytextarea"
出现带有 textarea 的新视图时将光标设置到 textarea 中。
似乎 .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>
谢谢你。