4
I created a javascript function that assembles a calendar. I need this calendar to assemble according to the number and days of the week of the given month. Ex(August 1 fell on a Tuesday). I also need that when I change the month my schedule will mount according to the selected month. Follows the code.
Function that mounts my agenda
$(document).ready(function () {
var str = '';
var aux = 1;
var tr = '';
var tbl = $('#calendar');
for (var i = 1; i < 32; i++) {
if (aux == 1) {
tr = '<tr>';
}
str += tr + '<td class="calendario btnExibirDetalhes" data-toggle="modal" data-target="#Modal" position="static">' + i + '</td>';
if (aux == 7) {
str = str + tr;
aux = 0;
}
aux++;
tr = '';
}
if (tr == '') {
tr = '</tr>';
str = str + tr
}
tbl.append(str);
});
Function that arrow the current month
$(document).ready(function () {
monName = new Array("Janeiro",
"Fevereiro",
"Março",
"Abril",
"Maio",
"Junho",
"Julho",
"Agosto",
"Setembro",
"Outubro",
"Novembro",
"Dezembro")
hoje = new Date();
var preenchemes = $('#mes');
preenchemes.append(monName[hoje.getMonth()]);
});
Take a look here: https://jqueryui.com/datepicker/
– Ivan Ferrer