console
document.addEventListener('reset', function(event) {
var target = event.target;
if (target.tagName.toLowerCase() === 'form') {
var inputs = [].slice.call(target.elements);
inputs.forEach(function (input) {
input.tempValue = input.value;
});
setTimeout(function () {
inputs.forEach(function (input) {
if (input.tempValue !== input.value) {
input.dispatchEvent(new Event('change'));
}
});
}, 1);
}
}, false);
const input = document.querySelector('[type="number"]');
const output = document.querySelector('output');
input.onchange = function () {
output.textContent = 68 * this.value;
};
<form>
单价:¥68
<p>数量:<input type="number" value="1"> 件</p>
<p>总价:<output>68</output>元</p>
<button type="reset">重置</button>
</form>