So I'm currently getting the value of a dropdown menu on change, and then adding it to the id of a div that surrounds the dropdown menu.
I'm wanting to be able to use this value later on in my code but right now it seems that I'm getting an undefined variable probably because it's not assigned on page load.
What would be a good way/better way of getting this value or assigning the value to a variable? And what would be a good way of reloading or refreshing the page so that it can be updated to the new variable?
I want to use the selectedValue var in the if statement instead of the "Big 12".
The person who suggested it was the same as another question I don't think is understanding my question.
Any ideas?
$('#team-select').change(function() {
var teamSelect = $(this).val();
$('.select-team-menu').attr('id', teamSelect);
});
var selectedValue = $('.select-team-menu').attr('id');
console.log(selectedValue);
getGames().done(function(results){
$.each(results, function (i, gameData){
$.each(gameData, function(key, game){
var gamesHome = game.home_team_conference;
var gamesAway = game.away_team_conference;
if(gamesHome == "Big 12" || gamesAway == "Big 12"){