【发布时间】:2019-07-23 00:17:17
【问题描述】:
我制作了一个可以用 javascript 填充表单的按钮,但它只填充页面上的第一个输入。我希望它填充任何闪烁的输入光标。 我需要帮助。 这是我的代码:
<script>
function autoFill() {
var input = document.getElementsByTagName("INPUT")[0]
input.value += "only works with the first input";
}
</script>
<input type="input">
<button type="button" onclick="autoFill()">fill it!</button>
<input type="input">
【问题讨论】:
标签: javascript html button input autofill