title: JavaScript Button/Input/Function, string reversal
body: <p>I need to make a function that accepts a user input in the form of a string, then when a button is hit returns it reversed. so far I have the function to reverse it, the button and user input field. However i'm struggling to get it to pass the information back and forth.</p>
  
  <pre><code>Html:
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;String reverser&lt;/title&gt;
   &lt;!-- imports script containing function--&gt;
  
      &lt;script type="text/javascript" src="problem23.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form&gt;
  &lt;!--defines user input field--&gt;
      &lt;input title="userinput" type="text" id="inputValueId" name="inputId"/&gt; 
  
  &lt;!--defines button which calls on the reverse function in javascript file--&gt;
  
      &lt;button name="reverseButton" type="submit" id="btn1" onclick="reverse()"&gt;Click me!&lt;/button&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  function reserve(conversionHolder){
      //picks up value
      var userInput= document.getelementById("inputValueId").value;
      //converts value
      var conversionHolder= userInput.split('').reverse().join('');
      //passes value outside of function?
      return conversionHolder;
  }//end reverse
  //sets userinput field to the reversed string
  document.getElementById('inputValueId').value = reverse(conversionHolder);
  </code></pre>