title: How Trim Text In A Div Class Using Javascript
body: <p>Can someone please let me know how to trim text like below using javascript only, not jQuery? This isn't working on mobile devices.</p>
  
  <p>I have a function that calculates different dates over a period of time, but I need to trim the last 42 characters of the divs class="calculated" output. </p>
  
  <p>The below works fine on desktop, but doesn't display the divs on mobile devices. I tested and removed the jQuery function and they show up, but I need them trimmed.</p>
  
  <p>Thanks</p>
  
  <pre><code>(function ($) {
  $('.calculated').text(function (_,txt) {
  return txt.slice(0, -42);
  });    
  })(jQuery);
  </code></pre>