title: Simple hide and show text with javascript
body: <p>I am a newbie when it comes to javascript as I am more custom to vba for office.</p>
  <p>However, now I want to write several paragraphs at the same page, but only showing the first, say to or three sentences of each paragraf and add a link in the text; see more...</p>
  <p>By clicking the link, see more..., it should show the whole paragraph and the link see more... should change to see less... at the end of the paragraf.</p>
  <p>I would like to have a javascript function to do this, taking an argument, perhaps an ID of the html.element to show or hide. That way I could reuse code or function, for each paragraph.</p>
  <p>Any suggestions or samples would be very appriciated.</p>
  <p>So if I have three paragraph at the same page, it should be able to display and hide part of the paragraph for each paragraph independently of each other.</p>
  <p>I found this code but it is hard coded:</p>
  <pre><code>&lt;button onclick=&quot;myFunction()&quot;&gt;Click Me&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction() {
    var x = document.getElementById(&quot;myDIV&quot;);
    if (x.style.display === &quot;none&quot;) {
      x.style.display = &quot;block&quot;;
    } else {
      x.style.display = &quot;none&quot;;
    }
  }
  &lt;/script&gt;
  </code></pre>
  <p>However, I want to reuse the function for any paragraph I want to. So I tried to make in a function with argument, but it does not seem to work?</p>
  <pre><code>    &lt;button onclick=&quot;myFunction(&quot;myDIV&quot;)&quot;&gt;Click Me&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction(EliD) {
    var x = document.getElementById(EliD);
    if (x.style.display === &quot;none&quot;) {
      x.style.display = &quot;block&quot;;
    } else {
      x.style.display = &quot;none&quot;;
    }
  }
  &lt;/script&gt;
  </code></pre>
  <p>Anybody that have a suggestion how to do this?</p>