javascript - 自动在输入框中填写数据

标签 javascript html

我有四个输入框。如果用户填写第一个框并单击一个按钮,那么它应该使用用户在第一个框中输入的值自动填充剩余的输入框。可以使用javascript完成吗?或者我应该说用用户最后输入的数据预填充文本框?

最佳答案

点击按钮,调用这个函数

function fillValuesInTextBoxes()
{
    var text = document.getElementById("firsttextbox").value;

    document.getElementById("secondtextbox").value = text;
    document.getElementById("thirdtextbox").value = text;
    document.getElementById("fourthtextbox").value = text;
}

关于javascript - 自动在输入框中填写数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9226371/

相关文章:

html - 自动调整同一行上的图像和/或图标的大小

java - 从 evaluateJavascript getElementById 返回的字符串带有斜杠和引号

html - Css 为特定类设置 h2 到 h6 的属性

javascript - 方法执行后更改按钮文本

javascript - 理解 jquery 回调

javascript - 分页,循环函数内的变量

javascript - HTML 文本区域 : use JavaScript to get wrapped text?

javascript - jQuery : how to show the next div and hide the present one

javascript - 从两个文本框输入动态创建单选按钮矩阵

php - 带有 Bootstrap 4 的 Codeigniter 3 分页类