Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » More HTML Questions
- han614698
- Scratcher
1000+ posts
More HTML Questions
That works, but I want to put the number in a sentene:That works, but Use this code to display follower count:<script> fetch('https://scratchdb.lefty.one/v3/user/info/han614698') .then(response => response.json()) .then(data => followerCount = data["statistics"]["followers"])); </script>
This sets the “followerCount” variable to the number of followers you have.just displays<p>I have <span id="followerCount">(followerCount)</span> followers</p> <script> fetch('https://scratchdb.lefty.one/v3/user/info/han614698') .then(response => response.json()) .then(data => followerCount = data["statistics"]["followers"])); </script>
“I have (followerCount) followers”
not
“I have 226 followers”
You'll have to programmatically change an empty element:<p id=followerCount></p> <script> fetch('https://scratchdb.lefty.one/v3/user/info/han614698') .then(response => response.json()) .then(data => followerCount = data["statistics"]["followers"])); document.getElementById("followerCount").innerHTML = followerCount; </script>
“I have (followers) followers”
<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>
Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why
- han614698
- Scratcher
1000+ posts
More HTML Questions
Thanks so much guys, this really helps!
If I need more help, I might come back here.
If I need more help, I might come back here.
<Scratch Wikian | Forum Helper | Almost to 6000 Posts! | Please be aware I may mistype things, my wrist is fractured>
Credit to -gge for the icons in my signature | I condensed all this code into five lines using [p] tags, idk why
- Discussion Forums
- » Advanced Topics
- » More HTML Questions