JSFiddle - React, Tailwind, and code Playground
HTML
<nav>
<input type="button" id="JAN" value="JAN" />
<input type="button" id="FEB" value="FEB" />
<input type="button" id="MAR" value="MAR" />
<input type="button" id="APR" value="APR" />
<input type="button" id="MAY" value="MAY" />
<input type="button" id="JUN" value="JUN" />
<input type="button" id="JUL" value="JUL" />
<input type="button" id="AUG" value="AUG" />
<input type="button" id="SEP" value="SEP" />
<input type="button" id="OCT" value="OCT" />
<input type="button" id="NOV" value="NOV" />
<input type="button" id="DEC" value="DEC" />
</nav>
JavaScript
$(function () {
function navbarMONTH(arg) {
var datas = JSON.parse(arg);
var dico = {
"JAN": "01", "FEB": "02", "MAR": "03",
"APR": "04", "MAY": "05", "JUN": "06",
"JUL": "07", "AUG": "08", "SEP": "09",
"OCT": "10", "NOV": "11", "DEC": "12",
};
var allButtons = document.querySelectorAll("nav input");
for (var i = 0; i < allButtons.length; i++) {
allButtons[i].onclick = function() {
chargeCal(dico[this.id], datas.year);
};
}
}
navbarMONTH('{ "year": 2015 }');
});
function chargeCal(month, year) {
console.log(month, year);
}