good day.
My question is: How to make several things update at the same time with a single data?
For example, if I have a text that says "Barcelona" automatically (for example, an image appears above this text) look in the folder of the directory for the "barcelona" logo with lowercase letters.
They told me that with JQuery and with events it can be done, but I did not find much about this, and I do not realize if this is what they told me.
<!DOCTYPE html>
<html>
<head>
<title>EJEM</title>
</head>
<body>
<img id="teamLogo" src="">
<span id="teamName"></span>
<button id="backward">ATRAS</button><button id="fordward">ADELANTE</button>
<span id="teamIndex" hidden="true">0</span>
<script type="text/javascript">
function changeTeam (team,logoURL){
document.getElementById('teamName').innerText = team;
}
function initializer(){
var TeamNames =['Barcelona', 'Real Madrid'];
var TeamLogos =[]
var teamIndex = 0;
document.getElementById('backward').onclick = function(){
if(teamIndex > 0){
teamIndex = teamIndex-1;
}
changeTeam(TeamNames[teamIndex], 0);
};
document.getElementById('fordward').onclick = function(){
if (teamIndex < TeamNames.lenght - 1) {
teamIndex = teamIndex+1;
}
changeTeam(TeamNames[teamIndex], 0);
}
changeTeam(TeamNames[0], 0);
}
window.onload = initializer;
</script>
</body>
</html>
Thank you very much.