When I reset the form the select element value reset but still display the old value
I'm using this to reset the form
$('#testForm')[0].reset();
In this example the 'Two' option is selected by default. If I change the selection and press 'reset form' the select value change back but still shows the old value
in Edge its working
https://jsfiddle.net/z6vk91sL/
Google Chrome 83.0.4103.61 (Official Build) (64-bit) (cohort: Stable)
$('#testFormReset').on("click", () => {
$('#testForm')[0].reset();
})
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id='testForm'>
<select>
<option value='1'>One</option>
<option selected value='2'>Two</option>
<option value='3'>Three</option>
</select>
<button id='testFormReset' type='reset'>
reset form
</button>
</form>
