I'm using the datepicker
plugin
All my datepicker input, has the class named datepicker
<input type="text" class="datepicker">
So, I have only one setting for the datepicker and I can use it on all pages, so I set it to a dateconfig.js
file, in that file I only have the following code:
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy',
dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado','Domingo'],
dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez']
});
But I have a page with a table
and there is input
with class="datepicker"
But when I call a modal via ajax, and there is also a input
, it does not load the plugin, so on the modal page I copy the configuration code and add it inside a <script>
// tag I'm not sure how to do this, but I'm not sure how to do this, but I'm not sure how to do it.
How could I solve these two problems?
Edit
The way I currently call the modal is this:
in my "index / grid / table"
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" id="modalContent">
</div>
</div>
</div>
My call of </script>
, I used a table
of plugin
, but I believe it is interpreted as this call of datepicker
:
$.ajax({
type: "GET",
url: "URL",
success: function (result) {
$("#modalContent").html(result);
},
complete: function (msg) {
$('#myModal').modal('show');
}
});