Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get datepicker to work using CoffeeScript #13

Closed
tomharrisonjr opened this issue Jul 31, 2012 · 2 comments
Closed

Can't get datepicker to work using CoffeeScript #13

tomharrisonjr opened this issue Jul 31, 2012 · 2 comments

Comments

@tomharrisonjr
Copy link

Rails 3.2.7 with latest bootstrap and jquery. I have an input field whose html is <input data-behavior="datepicker" id="race_begins_on" name="race[begins_on]" size="30" type="text" value="2012-07-29"> and a coffeescript file which executes on document.ready(); --

->
  $(document).on("focus", "[data-behaviour~='datepicker']", (event) =>
    $(@).datepicker({"format": "yyyy-mm-dd", "weekStart": 1, "autoclose": true}))

I also tried straight JS from your example using the coffeescript backtick escape.

I can see (through Chrome inspect element) the JS is getting included, the datepicker code is present, but nothing happens when my field gets focus. Any thoughts?

@Nerian
Copy link
Owner

Nerian commented Jul 31, 2012

Hi Tom,

The problem is you have 'behaviour' in the javascript and then 'behavior' in the html.

I always find british spelling more enjoyable :)

@tomharrisonjr
Copy link
Author

Doh! Thanks, and sorry for the bother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants