Hi guys,
I wrote the below code to look into a div to find its content (which is March), then loop through a months array to find a match of the div content.
It's not working for some reason, any idea why? If I change the
var current_month = document.getElementById('month');
to
var current_month = "March";
it works fine but it just won't recognise the word March in the div...
Any help would be great.
$('#arrow-right').click(function () { var current_month = document.getElementById('month'); var i; var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; for (i=0;i<months.length;i++) { if (current_month == months[i]) { months[i++]; var next_month = months[i]; alert(next_month); break; } // Code to be added later } });