How to Populate An Array of Month Number In jQuery - Javascript -
How to Populate An Array of Month Number In jQuery - Javascript -
can please take @ this demo , allow me know how can dynamically populate number of each month current year in jquery or javascript?
var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; var daysinmonth = []; var d = new date(); var n = d.getmonth(); (var = 0; < monthnames.length; i++) { daysinmonth.push(d.getmonth()); } console.log(daysinmonth);
var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; var daysinmonth = []; (var = 0; < monthnames.length; i++) { var year = 2014; var month = new date(monthnames[i] + " 01 "+ year).getmonth() + 1; daysinmonth.push(new date(year, month, 0).getdate()); } console.log(daysinmonth);
demo http://jsfiddle.net/0mj2cxmt/7/
javascript jquery
Comments
Post a Comment