title: Input value not updating on page when changed
body: <p>I have to do a web page for school that converts temperature between <em>celsius</em> and <em>fahrenheit</em>.
  I tried to make it with 2 input boxes that change value based on the value of the other input box, when I write something on one of the input boxes for the first time it works, but then even though on the code the value changes, on the page it doesn't appear. 
  I am new to javascript and html in general and I don't know what I'm doing wrong.</p>
  
  <p>This is the code:</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-js lang-js prettyprint-override"><code>        function cambiagradi(x,y) {
              if (document.getElementById(x).value == "Centigradi") {
                  document.getElementById(y).value = "Fahrenheit";
              }
              else {
                  document.getElementById(y).value = "Centigradi";
              }
          }
          function Conversione(from,to,gradi) {
              var x = document.getElementById(from).value;
                  if (document.getElementById(gradi).value == "Centigradi") {
                      document.getElementById(to).setAttribute("value", (x-32)*5/9);
                      
                  }
                  else {
                      document.getElementById(to).setAttribute("value", (x*9/5)+32);
                  }      
          }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html lang="it"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body style="background-color: #008080;"&gt;
      &lt;h1 style="text-align:center"&gt;Convertitore Temperatura&lt;/h1&gt;
  
      &lt;div class="container" style="display:flex; justify-content: center"&gt;
          &lt;div style=" padding: 1%; "&gt;
              &lt;p&gt;
                  &lt;input type="text" id="box1" oninput="Conversione('box1','box2','Gradi2')"&gt;
              &lt;/p&gt;
              &lt;p style="margin-left:10%"&gt;
                  &lt;label for="Gradi1"&gt;Gradi&lt;/label&gt;
                  &lt;select id="Gradi1" onchange="cambiagradi('Gradi1','Gradi2')"&gt;
                      &lt;option value="Centigradi"&gt;Centigradi&lt;/option&gt;
                      &lt;option value="Fahrenheit"&gt;Fahrenheit&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/p&gt;
          &lt;/div&gt;
          &lt;div style=" padding: 1%; "&gt;=&lt;/div&gt;
          &lt;div style=" padding: 1%; "&gt;
              &lt;p&gt;
                  &lt;input type="text" id="box2" oninput="Conversione('box2','box1','Gradi1')"&gt;
              &lt;/p&gt;
              &lt;p style="margin-left:10%"&gt;
                  &lt;label for="Gradi2"&gt;Gradi&lt;/label&gt;
                  &lt;select id="Gradi2" onchange="cambiagradi('Gradi2','Gradi1')"&gt;
                      &lt;option value="Fahrenheit"&gt;Fahrenheit&lt;/option&gt;
                      &lt;option value="Centigradi"&gt;Centigradi&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/p&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks in advance!</p>