javascript - Dojo: set default TextBox for typing -


one cursor set on search field when page loads. code:

<input class="search-input"   data-dojo-type="dijit/form/textbox"   data-dojo-attach-point="searchnode"   data-dojo-attach-event="keyup: searchkeyupevent"   data-dojo-props="     focused: true,     placeholder: 'search'" /> 

on page load textbox widget has focus frame, cursor not there..

  • is bug?
  • how 1 make sure cursor @ search widget?

edit: re-phrase question: how 1 set textbox, when page loads , user starts typing appear in textbox default?

focused documented read-only property in _focusmixin; setting won't think does.

to focus widget, need reference js , call focus method.

given you've defined attach point , attach event, i'll assume widget part of widget's template, in case should able focus in templated widget's startup method (though depending on how page/app loads, there may better time this):

startup: function () {     if (this._started) {         return;     }     this.inherited(arguments);      this.searchnode.focus(); }); 

(i'd suggest not calling attach point "searchnode", since it's widget in case, not dom node.)


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -