在haml中使用datepicker [英] Using datepicker within haml

查看:95
本文介绍了在haml中使用datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在haml中使用datepicker有点陌生,希望能得到一些指导.我在main.html中包含一个带有日期选择器的javascript,以及两个日期字段.不幸的是,当我尝试测试以下代码时,我一无所获.知道我可能会忽略的什么吗?任何帮助将不胜枚举.

I am sorta new to using datepicker within haml and was hoping to get some guidance. I have included a javascript with a datepicker within my main.html along with two date fields. Unfortunately, when I try to test the following code I get nothing. Any idea what I might be overlooking? Any help will be greatly appricated.

#content

%h3
  Please enter the following information:
=form('/search', :post)
=input(:id, :report_id, class: "formbox")
=input(:date, :start_date, class: "formbox")
=input(:date, :end_date, class: "formbox")
=submit('Submit', class: "button")

:javascript
  $(function() {
    $( "#start_date, #end_date" ).datepicker({format: 'yyyy-mm-dd'});
  });

推荐答案

在HAML中,缩进的方式是代码正常工作的关键.您需要按以下步骤更改缩进量:

In HAML, the way you indent is key to your code working correctly. You need to change your indentation as follows:

%h3
  Please enter the following information:
= form('/search', :post)
  = input(:id, :report_id, class: "formbox")
  = input(:date, :start_date, class: "formbox")
  = input(:date, :end_date, class: "formbox")
  = submit('Submit', class: "button")

:javascript
  $(function() {
    $( "#start_date, #end_date" ).datepicker({format: 'yyyy-mm-dd'});
  });

这篇关于在haml中使用datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆