title: JS: Changing an input's text(value) on file input file select
body: <p>I have successfully created an HTML form that gets a file from a user and also allows giving a name for the file. I have also succeeded in creating a javascript function that can get the name of the file from the upload stream, and only the name (without the path and extension). <strong>Problem is,</strong> I somewhat do not manage to change the input that's there for renaming the upload like I want to. Here is the working function with two demonstrative alerts:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function updateInput(val) {
      som = val.split('\\')[val.split('\\').length - 1];
      som = som.split('.')[0];
      alert('Hey 1');
      fileName.value = som;
      alert('Hey 2');
  }; &lt;/script&gt;
  </code></pre>
  
  <p>"Hey 1" alert is displayed and it's alright.
  "Hey 2" is actually <strong>not</strong> displayed!
  fileName is both the <strong>name</strong> and <strong>id</strong> of the input for the <em>file's name</em>, I <strong>DID</strong> try using document.getElementById('fileName').value = ... but with no luck. </p>
  
  <p><strong>Declaration of fileName:</strong></p>
  
  <pre><code>&lt;input type="text" runat="server" id="fileName" name="fileName" /&gt;
  </code></pre>
  
  <p>The javascript is located in the code under this input. The uploadImage input (which is type of file) is above this input. (Yes, the event is called and som gets the value I want it to have)</p>
  
  <p>*<em>I am trying to change the value of an input:text element. I will try the var thing.</em></p>
  
  <p><strong>THANK YOU IF YOU CAN HELP!</strong></p>