title: please enter a valid value the two nearest valid value is?
body: <p>my assignment is to make weight calculator but due to limitations of university I am not able to use all tags so I write code it works fine but gives me a error of <code>please enter a valid value the two nearest valid value are ***number*** and ***number***</code>.</p>
  <p>I think that is because of the <em>number</em> attribute in <em>input</em> tag but I can not able to find what's wrong and how to correct it.</p>
  <p>There is one more error if I only calculate one conversion output flash on screen and vanished if I get output in all fields then answer is shown.</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;head&gt;
    &lt;title&gt;Weight Convertor Calculator&lt;/title&gt;
    &lt;script&gt;
      var z;
      var x;
  
      function converter() {
        if (document.weight.kg.value &gt;= 1) {
          x = document.weight.kg.value;
          document.getElementById("g").value = x * 1000;
          document.getElementById("p").value = x * 2.2046;
          document.getElementById("m").value = x * 1000000;
          document.getElementById("ut").value = x * 0.0011023;
          z = 35.274 * x;
          document.getElementById("o").value = z;
  
        } else {
          window.alert("please enter any number greater than 0");
        }
      }
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body bgcolor="#b3f0ff"&gt;
    &lt;h1 align="center" style="color:#ff0066;"&gt; Weight Calculator&lt;/h1&gt;
    &lt;br&gt;
    &lt;br&gt;
    &lt;form name="weight" method="post"&gt;
      &lt;table align="center" style="color:#ff0066;"&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;b&gt;Enter your weight in Kg:&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="number" id="kg" name="kilogram" placeholder="enter_any_number"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;input type="submit" value="Convert" onClick="converter(kg.value)"&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="reset"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;b&gt;weight in Grams=&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="number" id="g" name="gram"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;b&gt;weight in Pounds=&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" id="p" name="pound"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;b&gt;weight in MilliGrams=&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="number" id="m" name="milligram"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;b&gt;weight in US Ton=&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" id="ut" name="uton"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td align="right"&gt;&lt;b&gt;weight in Ounces=&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="number" id="o" name="ounce"&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/form&gt;&lt;br&gt;
    &lt;p align="center" style="color:#ff0066;"&gt;&lt;b&gt;NOTE: Enter only numerical 
        value which is greater than 0&lt;/b&gt;&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>