我正在做一个项目,我只是想创建一个用于发布回复的 html 表单,但如果用户懒得回复,他/她只需点击自动生成评论并直接插入文本在表格上并在之后自动发布..
最佳答案
$( "#lazybutton" ).click(function() {
$('#inputBox').val("Hey I feel too lazy to type"); // filled automatically in input box
setTimeout(function(){
$('#form').submit(); //submitting form
}, 2000);
});
添加了休眠时间,以便用户在输入框填满后可以看到 2 秒。
关于javascript - 如何在 html 表单中自动插入文本并自动提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35450240/