0

我正在尝试以这种方式使用嵌入在haml中的jquery datepickers:

%body
    %canvas#neoviz
    %header
      %section#title
        %h1 DateTest
      %section#search
        %form{:action => "/", :method => "get"}
          %label Start:
          %input#start{:type => "text", :value => "#{@start}", :name => "start"}
          %label End:
          %input#end{:type => "text", :value => "#{@end}", :name => "end"}
      %input#loadnode{:type => "submit", :value => "Search", :class => "button"}
  %br{:style => "clear: both;"}
%section#content
  = yield

  %script{:type=>"text/javascript"}
    $(function(){
      $('#start').datepicker({dateFormat: 'yymmdd', onSelect: function(dateText, inst) {
        $('#start').datepicker('option','minDate', new Date(inst.selectedYear,   inst.selectedMonth, inst.selectedDay));
      }
    });
    $('#end').datepicker({dateFormat: 'yymmdd', onSelect: function(dateText, inst) {
      $('#end').datepicker('option','maxDate', new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay));
    }
  });
});

但日历没有出现,我的 Sinatra 应用程序返回此错误“非法嵌套:纯文本中的嵌套是非法的”

在这一行:

$('#start').datepicker({dateFormat: 'yymmdd', onSelect: function(dateText, inst)
4

0 回答 0