Tufail khan
Tufail khan

Reputation: 1

When I click the button my results show once blinking and then disappear

When I click the button my results show once blinking and then disappear:

function shipment_Result() {
  let getShipment = document.getElementById("shipment").value;
  if (getShipment == "standard") {
    var dateObj = new Date();
    var date_time = dateObj.toLocaleString();
    document.getElementById("dateTime").innerHTML = date_time
  }
}

HTML:

<body>
    <div>
        <form>
            <ul>
                <li>Standard: 7 days</li>
                <li>Express: 3 days</li>
            </ul>
            <label for="shipment">Choose a Shipment Type:</label>
            <select name="shipment" id="shipment" onchange="dropdownChange();">
              <option value="standard">Standard (7 days)</option>
              <option value="express">Express (3 days)</option>
            </select>
            <br><br>
            <button onclick="shipment_Result()" class="button button3">Click Here</button>
            <br>
            <p id="dateTime"></p>
            <p id="expectedDate"></p>
            <p id="fee"></p>
          </form>
    </div>
    <script src="index.js"></script>
</body>

Upvotes: 0

Views: 17

Answers (0)

Related Questions