setting minDate in datepicker in Rails

Posted by Sakshi Jain on Stack Overflow See other posts from Stack Overflow or by Sakshi Jain
Published on 2014-08-20T10:15:39Z Indexed on 2014/08/20 10:20 UTC
Read the original article Hit count: 190

I need to apply minDate attribute to the datepicker in Rails App.

In _admin_controls.html.erb

<%= f.input :end_date, wrapper: :append do %>
  <div id="datepicker" class="datepicker input-group edit-left">
    <%= f.text_field :end_date, :class => "datetime form-control" %>

application.js contains

jQuery(document).on('focus', 'input.datetime', function() {
  opts = {format: 'M dd, yyyy', autoclose: true};
  jQuery(this).datepicker(opts);
  jQuery(".datepicker").css("z-index",10000);
});

What should be the javascript to do so only for _admin_controls.html.erb?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery