Question

I'm new in this tecs and i need to do a datetimepicker or something to choose a date vale.. is it any sort of "datetime_field"? or only is posible using Java sciprt or Jquery... I tried something like this in my code.. but nothing heppends

= f.text_field :Eventdatetime, :class => 'form-control input-large input-with-feedback'
span class='help-inline' = error ? f.error_message_on(:Eventdatetime, :class => 'text-error') : pat(:example)
javascript:
   jQuery(function() {
    debugger;
    $( "#Eventdatetime" ).datepicker();
   });

Thanks!!

Était-ce utile?

La solution

There's no method datepicker() in jQuery (you may be getting confused with its sister library jQuery UI) so you'll need to include an external library to implement such functionality.

I can recommend this one, I use it myself in production environments and have never had any issues with it. It's as easy to use as you'd expect:

$("input").datetimepicker();
new Date($("input").val());
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top