Event Handler order issue

I’m going to do my best to describe my problem but I’m not even 100% sure what it is. Basically I’m making a simple browser game where players travel along a map of the united states. When they’re in a state, I have an html list of all the places they can go to from that state. I have event handlers programmed onto each state so when they’re clicked you go to that state and the player loses one movement point. My issue is when I tried to make a variable for saving the last location a player ended their turn on. My issue is that the entire game is driven by the .onclick event handlers from selecting different states to go to, and I’m trying to use one event handler to call a function to make it so when a player’s turn ends the next player begins their turn where it ended. For example for texas…

texas: function()
{
	var currentstate = document.getElementById("currentstate");
	currentstate.innerHTML = "TEXAS";
	
	var list1 = document.getElementById("list1");
	list1.innerHTML = "OKLAHOMA";
	list1.setAttribute("class","restore");
	list1.onclick = gameLogic.oklahoma;
	
	
	var list2 = document.getElementById("list2");
	list2.innerHTML = "ARKANSAS";
	list2.setAttribute("class","restore");
	list2.onclick = gameLogic.arkansas;
	
	var list3 = document.getElementById("list3");
	list3.innerHTML = "LOUISIANA";
	list3.setAttribute("class","restore");
	list3.onclick = gameLogic.louisiana;
	
	var list4 = document.getElementById("list4");
	list4.innerHTML = "NEW MEXICO";
	list4.setAttribute("class","restore");
	list4.onclick = gameLogic.newmexico;
	
	var list5 = document.getElementById("list5");
	list5.innerHTML = " ";
	list5.setAttribute("class","remove");
	
	var list6 = document.getElementById("list6");
	list6.innerHTML = " ";
	list6.setAttribute("class","remove");
	
	var list7 = document.getElementById("list7");
	list7.innerHTML = " ";
	list7.setAttribute("class","remove");
	
	var list8 = document.getElementById("list8");
	list8.innerHTML = " ";
	list8.setAttribute("class","remove");
	
	
	gameLogic.minusTurn();
	
	if (gameLogic.playerturn == 1)
	{
	gameLogic.playerOneLocation = "texas";
	return gameLogic.playerOneLocation;
	}
	
	if (gameLogic.playerturn == 2)
	{
	gameLogic.playerTwoLocation = "texas";
	return gameLogic.playerTwoLocation;
	}
	
	if (gameLogic.playerturn == 3)
	{
	gameLogic.playerThreeLocation = "texas";
	return gameLogic.playerThreeLocation;
	}
	
	if (gameLogic.playerturn == 4)
	{
	gameLogic.playerFourLocation = "texas";
	return gameLogic.playerFourLocation;
	}
	
},

So the variable should be saved every time a player visits that state, and I have no issue with that, but when the turn changes I try calling the function for the state the player should be at and what it gives me is the name of the state they ended their turn in plus the locations for whatever the last player clicked. It’s for whatever reason adding the event handler with the function. I have no idea how to fix this. Please help. Here’s the code I use to try and put them back in the state they need to be

lastState: function()
{
	
	
	if (gameLogic.playerturn == 1)
	{
		if (gameLogic.playerOneLocation == "texas")
		{
		gameLogic.texas();
		}
		
	}
	
},

For someone to begin to try and help, you will need to provide a link to the full project code and describe in detail how to replicate “the problem”.

It’s a 5,000 line project, I linked the code relevant to the problem. I’m assuming nobody has the time to comb a 5,000 line document. I provided as much detail as I could.

The code you posted may or may not be the culprit. Without being able to test the code while reproducing the “problem”, it is very difficult to debug.