Question: I want to add the datepicker widget to one of my select fields.
I am currently using rails 3.2.13 with ruby 1.9.3.p325.
I also included the 'jquery\_datepicker' gem, as well as 'jquery-rails' and 'jquery-ui-rails'

The form code looks as following.

```
  <div class="field">
    <%= f.label :datum %><br />
    <%= f.text_field :datum , :id => "datepicker" %>
  </div>

```

The included javascript is: 

```
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require select2
//= require_tree .

$ ->
  $("#practice_toolkeeper")
    .select2({
         allowClear: true,
         placeholder: 'Select an item'
    })
    .select2('val',$("#toolkeeper_value").val())    

$ ->
  $("#datepicker").datepicker()

```

which generate HTML

```
<div class="field">
  <label for="practice_datum">Datum</label><br />
  <input id="datepicker" name="practice[datum]" size="30" type="text" />
</div>

```

if you select the input field, nothing is happening

Answer: 
Replace 

```
$("datepicker").datepicker();

```

with 

```
$("#datepicker").datepicker();

```

Missing `#` in selecotr. As `datepicker` is `id` of element. You need to use `#` in selector.

**UPDATE**

```
jQuery($)->
 $("#datepicker").datepicker();
 .....

```

This should work.

**Update 2**

Suppose you have following content in `sample.coffee` file - 

```
jQuery ->
 $("#datepicker").datepicker();

```

You need to compile abouve file with following command - 

```
coffee -c sample.coffee

```

This will then generate `js` file with following contents - 

```
(function() {
  jQuery(function() {
    return $("#datepicker").datepicker();
  });

}).call(this);

```

If you are not familiar well with coffee script, go though <http://coffeescript.org/#installation>
You missed the `#` to select element with id datepicker. It should be

```
$("#datepicker").datepicker()

```