I have a question about the following. I want to display a logo that changes every week by dynamic data. Below you see the code that generates the dynamic data.
<!-- Paste this where you want the article to appear -->
<div
data-article="programma"
data-param-teamcode="89678"
data-param-gebruiklokaleteamgegevens="NEE"
data-param-aantaldagen="100"
data-param-eigenwedstrijden="JA"
data-param-thuis="JA"
data-param-uit="JA"
id="clubcode1" data-fields="thuisteamclubrelatiecode"
></div>
<!-- This should be pasted once in the <head> for the best performance. If you already have jQuery included skip that script -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://dexels.github.io/navajofeeds-json-parser/js/dist/feed-0.0.1.js"></script>
<script>
feed.init({
clientId: "vbvEvjxCyc"
});
</script>
When running the code above it generates three codes. The output of this code gives me: BBBC523, BBBC523 and BBBF79V. I need the first in the list for my other code to display a logo.
My other code looks like this:
<script>
var link = "https://logoapi.voetbal.nl/logo.php?clubcode=";
var clubcode2 = document.getElementById('clubcode1');
var clubcode3 = clubcode2.getAttribute('data-fields');
document.write("<img src=" + "'" + link + clubcode3 + "'");
</script>
The output that I need to display the logo of a football/soccer team looks like this:
document.write('<img src="https://logoapi.voetbal.nl/logo.php?clubcode=BBBC523"')
So I need to make a variable of the output of the dynamic data. From that output I need the first/first-child. I this case BBBC523. Can someone provide me the right steps/code to fix it?
Right now it got this <img src="https://logoapi.voetbal.nl/logo.php?clubcode=thuisteamclubrelatiecode" <="" div=""> but this is not good.
I searched hours on the internet to get a solution, but I'm still not successful. I like to see a solution for my problem.