[英]Fill 20 textboxes with random array elements using jQuery
Alright so I'm trying to create a userscript that will prefill 20 textboxes with a random element of an array. 好吧,所以我试图创建一个用户脚本,该脚本将使用数组的随机元素预填充20个文本框。 I have this line of code here:
我在这里有这行代码:
$("textarea").val(nottrashy[Math.floor(Math.random() * nottrashy.length)]);
which I'm trying to modify to make the textboxes all get a different random element, not the same random element. 我正在尝试修改以使所有文本框都具有不同的随机元素,而不是同一随机元素。 All of the textboxes have the same value, so I can't target individual ones.
所有文本框都具有相同的值,因此我无法定位单个文本框。 Can anyone help?
有人可以帮忙吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.