I can't see why my if/else statement is not working correctly?
JavaScript
var month_games = "Games";
var month_hit = "Hit";
var month_stake = "Stake";
var month_profit = "Profit";
var games_month = 0;
var hit_month = 0 + "%";
var stake_month = 0;
var profit_month = 0;
$( document ).ready(function(){
document.getElementById("Games_Month").innerHTML = month_games;
document.getElementById("Hit_Month").innerHTML = month_hit;
document.getElementById("Stake_Month").innerHTML = month_stake;
document.getElementById("Profit_Month").innerHTML = month_profit;
});
$('#January').click(function(){
if ($('#Games_Month').innerHTML = month_games)
{$('#Games_Month').innerHTML = games_month;}
else {$('#Games_Month').innerHTML = month_games;}
});
HTML
<table class="table">
<thead>
<tr id="January">
<th>January</th>
<th id="Games_Month"></th>
<th id="Hit_Month"></th>
<th id="Stake_Month"></th>
<th id="Profit_Month"></th>
</tr>
</thead>
Now, when I click on #january, I would like the inner.HTML of the other ID's to change to what another variable is, but when clicked again, to change it back.
What is wrong with my code?
Aucun commentaire:
Enregistrer un commentaire