ruby - Bootstrap time picker rails without gem -
i trying
i have starts_at:datetime
field , want fill form using bootstrap-datetimepicker
here form:
= simple_form_for @event |f| = f.input :title = f.input :starts_at = f.button :submit
my main.js file:
$(document).ready(function(){ $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd'}); });
how can give starts_at
datettimepicker input style?
you'll have call .datetimepicker()
method on input element want give datepicker. simple_form should generate element id "event_starts_at"
, try:
$("#event_starts_at").datetimepicker({format: 'yyyy-mm-dd'});
if doesn't work or if want give input element different id
, can override passing option:
= f.input :starts_at, id: "event_starts_at"
Comments
Post a Comment