0
I have a bootstrap-datepicker with the following JS:
$(document).ready(function()
{
var dataIni = $("#calendarioIni");
var dataFim = $("#calendarioFim");
$('#calendarioIni').datepicker({
startDate: '01/01/1998',
endDate: '31/12/1998',
dateFormat: 'dd/mm/yy',
});
$('#calendarioFim').datepicker({
startDate: '01/01/1998',
endDate: '31/12/1998',
dateFormat: 'dd/mm/yy',
});
});
But I will use it on several pages in my project, how could I reuse code?
it would be ideal if I create a . js just to put it?
– V.Avancini
Not necessarily. You can take advantage of this js to put codes that "repeat" on most pages in order to have a smoother maintenance.
– Mateus Veloso
good, for now only this datepicker that will repeat even...
– V.Avancini
the code would be exactly the same? including this part: $(Document). ready(Function()? I think it’s only Function that is right?
– V.Avancini
This ready() in Document means, after loading it, to my point of view it can continue like this.
– Mateus Veloso