1
I got the following:
$("h2").text(function(index, currentText) {
return currentText.substr(0, 100) + '...';
});
It limits the text of the H2 tag to 100 characters and displays the three dots at the end, however the dots are displayed even if the characters do not reach 100 characters, so it makes no sense to have the dots if the title is already complete. How can I display the points only if H2 exceeds the limit?