title: How to convert from image to text using Javascript
body: <p>I am trying to convert image to text. When anyone upload image then press &quot;Submit&quot; image text should be show into the textarea. My following code is not working, please help!</p>
  <p><strong>Code:</strong></p>
  <pre><code> &lt;html&gt;
      &lt;body&gt;
      
      &lt;input type=&quot;file&quot; id=&quot;myFile&quot; name=&quot;filename&quot;&gt;  
      &lt;br&gt;&lt;br&gt;
  &lt;button onclick=&quot;myFunction()&quot;&gt;Submit&lt;/button&gt;
  &lt;br&gt;&lt;br&gt;
      
      &lt;label&gt;&lt;b&gt;Your Converted Text:&lt;/b&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt;
      
      &lt;textarea cols=&quot;30&quot; name=&quot;original&quot; rows=&quot;10&quot; style=&quot;width: 100%;&quot; id=&quot;convertedText&quot;&gt;
      &lt;/textarea&gt;
  
      &lt;script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'&gt;&lt;/script&gt;
      
      &lt;script&gt;  
       function myFunction() {
             var myImage= document.getElementById('myFile');
            
      
             Tesseract.recognize(myImage).then(function(result){
      
              console.log(result.text);
      
             document.getElementById(&quot;convertedText&quot;).value = result.text;
              
      
              });
      }
              &lt;/script&gt;
              
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>