Forum Discussion

RionaMenezes's avatar
RionaMenezes
Community Member
3 years ago

How to add in a live character count of Text Entry field.

Hi,

I am trying to create a situation where the learner can see how many characters they have typed since I have set a character limit. Is there any way of doing this without having a button to press? I want the count to change as the learner types.

Many thanks.

1 Reply

  • RionaMenezes's avatar
    RionaMenezes
    Community Member

    Hi Matthew, thanks for the swift reply. I have so far only managed to get the character count to work if a button is pressed using this bit of Javascript:  

    let player = GetPlayer()
    let text1 = player.GetVar("TextEntry")
    let count1 = text1.length
    player.SetVar("CharLength",count1)

    I'm a bit new to SL and not familiar with coding, admittedly the method above has flown straight over my head.