JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li class="latestnewsfooterCol">tests this</li>
<li class="latestnewsfooterCol"><p>a very long text</p></li>
</ul>
JavaScript
$(function() {
$('li.latestnewsfooterCol').each(function() {
var $this = $(this);
$this.text( $this.text().slice(0,5) );
});
});