jquery trim last ‘N’ characters Below the example to trim last two characters. Source code <script> var content_string = 'RAMP IT'; var content_string_name = content_string.slice(0, -2); //=> slice(0, -N) - update N based on your need. alert(content_string_name); </script>