【发布时间】:2018-09-28 10:21:51
【问题描述】:
我在将我的 jquery 包含到我的 haml 文件中时遇到了一些麻烦,我是新手。 我想包含一个日期选择器并将值保存到一个变量中
我已将其包含到我的 application.js 和 gem 'jquery-timepicker-addon-rails'到我的 gemfile 中:
//= require jquery-ui
//= require jquery-ui-timepicker-addon
//= require jquery_ujs
这是什么:创建一个 var,我可以在其中存储日期时间,然后从我的用户表中将其减去 last_sign_in_at。
这是我想出的:
-$date =
%h3 Please enter the following information:
= form('/search', :post)
= input(:users, :last_sign_in_at, class: "formbox")
= submit('Submit', class: "button")
:javascript
$(function() {
$( "#start_date, #end_date" ).datepicker({format: 'yyyy-mm-dd'});
});
但是,日期选择器没有出现,我很确定我的 var $date 有问题。
这是我遇到的错误:
content can't be both given on the same line as %h3 and nested within it
有什么建议吗?
【问题讨论】:
标签: jquery ruby-on-rails haml