title: Can't get my Javascript file to run when viewing my HTML file
body: <p>I'm trying to implement my javascript code to implement a show more and show less function when the description of my page goes over a character limit. However when trying to run the site, it just shows all of the text entered in the description and it doesn't seem as though the script file is running at all. I'm wondering if it may be due to not placing the script file in the html code correctly?  </p>
  
  <p>Here is a snippet of my html: </p>
  
  <pre><code> &lt;div class="newsletter_titles"&gt;Weekly Economic Financial Commentary- &lt;strong class="newsletter_description_brief"&gt;Description of newsletter&lt;/strong&gt;
       &lt;span class="more"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/span&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>...and my script code:</p>
  
  <pre><code>$(document).ready(function() {
      // Configure/customize these variables.
      var showChar = 100;  // How many characters are shown by default
      var ellipsestext = "...";
      var moretext = "Show more &gt;";
      var lesstext = "Show less";
  
      $('.more').each(function() {
          var content = $(this).html();
  
          if(content.length &gt; showChar) {
  
              var c = content.substr(0, showChar);
              var h = content.substr(showChar, content.length - showChar);
  
              var html = c + '&lt;span class="moreellipses"&gt;' + ellipsestext+ '&amp;nbsp;&lt;/span&gt;&lt;span class="morecontent"&gt;&lt;span&gt;' + h + '&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a href="" class="morelink"&gt;' + moretext + '&lt;/a&gt;&lt;/span&gt;';
  
              $(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;
      });
  });
  </code></pre>
  
  <p>What its supposed to show:</p>
  
  <p><a href="https://i.stack.imgur.com/I6Tp1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I6Tp1.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/c994g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c994g.png" alt="enter image description here"></a></p>
  
  <p>However its showing this:</p>
  
  <p><a href="https://i.stack.imgur.com/naxDL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/naxDL.png" alt="enter image description here"></a></p>