1
I have the following code:
if (i.link[E].href == "teste") {
var u = i.link[E].type.substring(0,130) + "...";
}
It limits the characters to 130, and displays the three dots at the end of the text. However, the dots are displayed even if there are no more than 130 characters, so it makes no sense to have 50 characters and have three dots at the end. How do I display the points only if the 130 limit is reached?
why don’t you add
i.link[E].type.length > 130
in yourif
? it only applies if the content is more than 130...– fernandosavio
I got it. I believed it was really simple, but I’m a beginner in js. Thank you.
– Ericki