I'm trying to make my code dependent on certain variables by changing them with a select. Is it possible to access the result outside of the function in jQuery?
js
function myCalendar(){
//global variable
var thismonth = '';
//onchange get selected month
$(document).on('change','#select_month',function(){
thismonth = $(this).val();
});
//check if empty
if(thismonth !==''){//always return empty?
var mm = thismonth;
}else{
var mm = new Date().getMonth();
}
}