【问题标题】:How to run the input value with the function如何使用函数运行输入值
【发布时间】:2021-07-06 16:50:02
【问题描述】:

我已经用 JavaScript 编写了这个程序,通过插入值,结果会显示在控制台中并且它可以正常工作 但我想通过在输入中输入值来应用这些功能, 如果我没有正确解释,我很抱歉:) 请帮帮我,谢谢

HTML: html image

JavaScript: js image

【问题讨论】:

  • 不要分享图片,在这里分享你的代码sn-p。

标签: javascript html function object dom


【解决方案1】:

当输入改变时,您需要将函数与输入链接

document.querySelector('#income').addEventListener('change', (event) => {
    addIncome(userAccount, event.target.value);
});

document.querySelector('#outcome').addEventListener('change', (event) => {
    addOutgo(userAccount, event.target.value);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-21
    • 1970-01-01
    • 2023-01-12
    • 2011-06-20
    • 2020-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多