【发布时间】:2012-12-06 21:25:56
【问题描述】:
我正在尝试在我的 simple_form 中使用 Jquery 日期选择器。
我有一个字段
<%= simple_form_for @customer, :html => { :class => 'form-horizontal' } do |f| %>
<%= render "shared/error_messages", :target => @customer %>
<%= f.input :start_lease_date, :as => :text %>
<% end %>
我已经安装了 Jquery-ui gem,我在我的 application.js 中添加了 require 选项
//= require jquery.ui.datepicker
我还在 application.css 中添加了 require
*= require jquery.ui.datepicker
我还添加了 customer.js.coffee 文件,其中包含以下内容
jQuery ->
$('#customer_start_lease_date').datepicker
dateFormat: 'yy-mm-dd'
但是,我的 Start_lease_date 字段仍然没有显示日期选择器
【问题讨论】:
-
可能看起来很明显,但您是否在您的应用程序/js 中包含 //= require jquery
-
你能用你的 application.js 文件(只是顶部)和 require 等更新你的问题