I was trying to add the show more link at the end of my paragraph but the more link is not appearing correctly or not truncating at the right character count. 

Code here: <https://jsfiddle.net/7sp0mpp8/>

```
$(document).ready(function() {

    var showChar = 300;
    var ellipsestext = "";
    var moretext = "more";
    var lesstext = "less";
    $('.more').each(function() {
        var content = $(this).html();

        if(content.length > showChar) {

            var c = content.substr(0, showChar);
            var h = content.substr(showChar-1, content.length - showChar);

            var html = c + '<span class="moreelipses">'
                             + ellipsestext 
                         + '</span>' 
                         + '<span class="morecontent">' 
                             + '<span>' 
                                 + h 
                             + '</span>&nbsp;&nbsp;' 
                             + '<a href="" class="morelink">' 
                                 + moretext 
                             + '</a>' 
                         + '</span>';

            $(this).html(html);
        }

    });

    $(".morelink").click(function(){
        if($(this).hasClass("less")) {
            $(this).removeClass("less");
            $(this).html(moretext);
        } else {
            $(this).addClass("less");
            $(this).html(lesstext);
        }

        $(this).parent().prev().toggle();
        $(this).prev().toggle();

        return false;
    });
});

```