I'm using the Bootstrap Datepicker in my ruby-on-rails-project, but it needs some changes (for better understanding of my problem, just go to my heroku-site: https://evening-basin-18662.herokuapp.com/static_pages/stackoverflow and hit the text-field):
- The Bootstrap Datepicker only shows up, after I hit the text-field.
But I want, that there is no text-field and that the datepicker is already there, when the page is loaded up.
- The Bootstrap Datepicker shows up at a weird location (on my site, it shows up left down, under the footer).
But I want, that it shows up in the middle of the page, above the footer, (where the button is).
This is my implementation:
<h2>Neuer Event</h2><br>
<input type="text" class='datepicker' >
<script type="text/javascript">
$(document).ready(function(){
$('.datepicker').datepicker({
multidate: true,
format: 'yyyy-mm-dd'
});
});
</script>
<br>
<button class="btn3">Add dates to the hidden field</button>
Any ideas, what is causing this behaviour? Thanks in advance!
Edit:
I found out, how I can add the datepicker to a specific div with the container option:
<script type="text/javascript">
$(document).ready(function(){
$('.datepicker').datepicker({
multidate: true,
format: 'yyyy-mm-dd',
todayHighlight: true,
container: ".jesus",
});
});
</script>
In this example, the datepicker will appear in the div with the class "jesus".
Now I only need to find out, that the datepicker appears, without to click on the textfield.