title: How to reverse the text by using Javascript?
body: <p>I am trying to write code to reverse my text. Ex: Apple is Fruit --> Fruit Is Apple. I written code which is not working. Thanks for the help!</p>
  
  <p><a href="https://jsfiddle.net/7dmyvtep/" rel="nofollow noreferrer">JSFiddle</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;body&gt;
    &lt;center&gt;
      &lt;form&gt;
        &lt;textarea autocomplete="off" cols="30" id="TextInput1" name="message" rows="5" style="border: 3px solid #73AD21; width: 40%;"&gt;&lt;/textarea&gt;
        &lt;textarea autocomplete="off" cols="30" id="TextInput2" name="message" rows="5" style="border: 3px solid #73AD21; width: 40%;"&gt;&lt;/textarea&gt;&lt;br /&gt;
        &lt;input id="WhiteSpaceRemove" onclick="myFunction()" style="border: 3px solid #73AD21;" type="button" value="Convert" /&gt;
      &lt;/form&gt;
    &lt;/center&gt;
    &lt;script&gt;
      function myFunction() {
        var x = document.getElementById("TextInput1").value;
  
        document.getElementById("TextInput2").innerHTML = x.reverse();
        document.getElementById("CopyButton").value = "Copy Text!";
      }
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>