soulim / ember-cli-bootstrap-datepicker

Datepicker component for Ember CLI
http://sul.im/ember-cli-bootstrap-datepicker
MIT License
68 stars 57 forks source link

How do I set focus to the datepicker? #92

Closed matthellstrom closed 7 years ago

matthellstrom commented 7 years ago

I'm clicking a link which is showing the datepicker but all it does is show the input box. As soon as I click on it it brings up the datepicker, but I'd like to set focus on it automatically in my js. I use this for regular input fields and it works great.

Ember.run.schedule("afterRender",this,function() { Ember.$("#datepickerid").focus(); });

Here's my datepicker html:

{{bootstrap-datepicker value=selectedBoHeader.js_ship_date class="input-sm input-75" id="datepickerid" clearBtn=true format="m/d/yyyy" assumeNearbyYear=true todayHighlight=true changeDate="shipDateChanged" autoclose=true}}

Is there a way to do this?

matthellstrom commented 7 years ago

I figured it out! openOnFocus=true