Version Rails 5 beta 3.我使用的是gem jquery-ui-rails 5.0.5
的Gemfile
................................................
gem 'jquery-rails'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-ui-rails'
的application.js:
//= require turbolinks
//= require jquery
//= require jquery-ui/datepicker
//= require jquery_ujs
//= require jquery.turbolinks
//= require cocoon
//= require jquery_nested_form
//= require jquery-fileupload/basic
application.css
/**
* application.css
*
*= require jquery-ui/datepicker
*= require_self
*= require_tree ./all
自由职业者/ edit.html.erb
<li class="form-fields__group form-fields__group_birthdate">
<label for="freelancer_birth_date">Birthday</label>
<div class= "field">
<%= f.text_field :birthday %>
</div>
</li>
表名:自由职业者
#
# id :integer not null, primary key
# first_name :string
# last_name :string
# rate :integer
# birthday :date
Javascript角/ freelancer.coffee
jQuery ->
$('#freelancer_birthday').datepicker()
我点击字段生日,但不要打开datepicker。什么都没发生。怎么能解决这个问题?谢谢