This script isnt working

Okay so i have this custom code

<div class="MessageBox">
<h3>Message</h3>
<textarea placeholder="Message" onkeyup="countLetters()"></textarea>
<p>Total Characters : <span class="count">0</span></p>
</div>
<script>
  const textarea = document.querySelector('textarea');
  const count = document.querySelector('.count');

  function countLetters() {
    const text = textarea.value;
    const textLength = textarea.value.length;
    count.innerText = '${textLength}';
  }
</script>

basically it should be setting the count to the number of characters but instead it is setting the count to literally this ${textLength} im still learning so maybe i messed up

oh my bad thanks anyway tho

Set count.innertext to just ‘textLength’ E.g.

count.innerText = textLength;
<textarea placeholder="Message" onkeyup="countLetters(this);"></textarea>
<p>Total Characters : <span id="count">0</span></p>
<script>
function countLetters(obj){
  document.getElementById('count').innerText = obj.value.length;
}
</script>

Kuli we love you to death for all the help you give, but please please please stop helping them after we’ve told them they need to go elsewhere or post in another forum. We’re trying so very hard to reroute people to the correct forum or locations and when you post the answers in here anyways, they have no reason to bother posting anywhere else. No offense meant here at all so please don’t take offense to this, it’s just that we need to get people to the right places. Otherwise what’s the point of having different forum Categories right? :slight_smile:

1 Like

I will not give tips about scripts anymore, I will let you and your friend tell them go elsewhere and ask for a solution

1 Like

Nooo please don’t stop helping, just want to get them in the right place for it is all :slight_smile:

@Kuligaposten - I think you’re taking jo’s meaning wrong. The devs are not moderating the forums, and although Martin has said they have aspirations to do so as soon as they get BS5 out the door, I have my reservations.

Every new person who buys BSS and has a problem with ANYTHING, just dumps in the first category - Bootstrap Studio Help, even though there is a Webdesign Help category specifically for asking questions just like the one that the OP posted.

It may seem trivial, but it terms of trying to find solutions via the forum search function, there are over 2,267 posts in the Bootstrap Studio Help category, and a mere 22 in the Webdesign Help category. I’m sure that over a 1,000 of those 2,257 posts have nothing to do with using the BSS software, and probably should be moved to WebDesign Help.

The basic search feature would be drastically more useful if people could simply search in the category that is most likely to have an answer that will help them. If they need help with using the program, they would search “Bootstrap Studio Help” category, whereas if they needed help with writing a custom script, they would search the WebDesign Help category (which I’d personal like to see renamed “Coding and Technical Support.”)

Nobody wants to get rid of new people who need help. We just want to try and get this Forum organized, which benefits everyone.

And we certainly need you to stick around and keep helping people! You’re one of the most talented users in the forums!