I need to divide the content into two separate sections. Unfortunately, the first variable (summarySentence1and2) is not capturing the desired result, while the second variable (summarySentanceOthers) is storing all of the content from the source field. I aim to split the content from 0 to 28 characters in the first variable and from 28 to the end in the second variable.
var summaryText = $(this).find('.review-body .field-name-field-review-summary').text();
var summarySentence1and2 = summaryText.split(' ').slice(0, 28).join(' ');
var summarySentanceOthers = summaryText.split(' ').slice(28).join(' ');
//alert(summarySentence1and2);
//alert(summarySentanceOthers);
$('#first').text(summarySentence1and2);
$('#second').text(summarySentanceOthers);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<div class="review-body" itemprop="reviewBody">
<div class="field-name-field-review-summary">
We had an excellent guide in Antonino who took us on some excellent routes and had extensive knowledge of the area, fauna and history of the volcanoes and the evolution of the landscape. The hotels and included meals were disappointing and should have been of a higher quality.
</div>
</div>
<p id="first"></p>
<p id="second"></p>