Can you guess who will win a particular sports match based on the images below?
Here's what I'm trying to achieve:- Change the text color of selected teams to black so that users can easily see their selection before submitting
while($fixtures > $upcoming){
// code for selecting team and score
}
// When team names are displayed, change style on click
<div id="dispPicks">
foreach($dispTeam1 as $key => $team1) {
echo '<p class="team1">' . $team1 . '</p>';
echo ' VS ';
echo '<p class="team2">' . $dispTeam2[$key] . '</p>';
}
</div>
I attempted to write this JavaScript:
var elements = document.getElementById("makePicks").elements;
var len = elements.length;
var team = [];
for(x=0; x<len; x++){
if(elements[x].type == "radio" && elements[x].checked== true) {
team[x] = t1[x].value;
}
}
My issue:
The variable team[x]
now holds the selected team, but I am unsure how to proceed with changing the style of the team names from here.
Considerations:
- The teams/fixtures are dynamically generated from a PHP loop in every round, resulting in a different number of fixtures each time.