2021-05-29

Show / hide element based on which option was selected [closed]

What would be the JavaScript code to display the input field if I choose the second <option> tag and reverse (do not display input) if I choose the first <option>?

<div id="bmi">
  <p id="head">
    BMI Calculator
  </p>
  <p><b>Select the Measure
    <select id="method" onchange="standard()">
      <option id="metric">Metric</option>
      <option id="standard">Standard</option>
    </select>
  </b></p>
  <p><b>Input your Height Below:</b></p>
  <br>
  <input type="text" id="height" />
  <p><b>Input your Weight Below:</b></p>
  <input type="text" id="weight" />
  <br>
  <button id="onSubmit">Calculate</button>
  <br>
  <h1 id="result"></h1>
</div>


from Recent Questions - Stack Overflow https://ift.tt/3c1Emr2
https://ift.tt/eA8V8J

No comments:

Post a Comment