Reputation: 539
I'm trying to use the datetimepicker function from bootstrap4, I'm using this gem datetimepicker. this is my gemfile(part of it)
gem 'bootstrap', '~> 4.1.3'
gem 'jquery-rails'
gem 'responders'
gem 'bootstrap4-datetime-picker-rails'
gem 'mini_racer'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.1'
this is the simple html.erb file
<h1>Bets#show</h1>
<p>Find me in app/views/bets/show.html.erb</p>
<div class="datetimepicker1">
<input name="prova" data-format="dd/MM/yy hh:mm"/>
</div>
and this is the coffee file
$(".datetimepicker1").datetimepicker
What I'm missing? It should work like this
[EDIT] I also added the require in application.js and import in application.scss
Upvotes: 0
Views: 2915
Reputation: 521
Please use gem 'jquery-ui-rails'
. Then datepicker will be available in your app.
//= require jquery-ui
add the jQuery UI CSS to your application.css
/*
*= require jquery-ui
*/
Jquery
$(function() {
$('.datepicker').datepicker();
});
Upvotes: 1