-1

我创建了一个看起来像这样的 HTML 表单(我输入了前三个值)。

主队:红军
客队:蓝军
第一击球:红军
第二击球:
第一击球:
第二击球:

如果红队先击球,我知道蓝队一定是第二击球,先上场,而红队先上场。按照这个逻辑,我想为我的用户节省一些时间并自动填充剩余的三个字段 - 使用 jQuery。

我猜我需要主队、客队和 Batted 第一个输入框上的事件监听器。当这些注册为具有内容时,我需要将剩余的空框设置为适当的值(按照上面的逻辑)。谁能给我一些关于从哪里开始解决这个问题的想法。

谢谢,

4

1 回答 1

3

How can I get jQuery to populate these fields automatically via some simple logic?

$("#yourinputfield").val("some value here");

You can use the above selector to change the value of an input field of type text

<input id="yourinputfield" type="text" value="" />
于 2013-03-31T22:02:59.360 回答