[英]Form Input Value not updating from script
I have a text input as follows:我有一个文本输入如下:
<td><input type="text" class="form-control assetID" autocomplete="off" placeholder="Asset ID" name="assetID[]"></td>
and a script that runs when the first input field is modified.以及在修改第一个输入字段时运行的脚本。 I would like to update the value of the 2nd input when this script runs:
我想在此脚本运行时更新第二个输入的值:
$this.closest('tr').children('.form-control.assetID').val(assetID);
with the value of the asset variable.与资产变量的值。 I can't get the form input to update here when this script runs and can't see the issue here?
当此脚本运行时,我无法在此处更新表单输入并且在此处看不到问题? I will have a series of similar inputs that are added dynamically so I'm not using an id for these but targeting them by the class.
我将有一系列动态添加的类似输入,因此我没有为这些输入使用 id,而是通过 class 来定位它们。
Not this不是这个
.children('.form-control assetID')
But this但是这个
.children('.form-control.assetID')
Explanation: Selecting element with 2 classes requires to not keep space between both classes, also prefixing both classes by .
说明:选择具有 2 个类的元素需要在两个类之间不保留空格,同时在两个类前面加上
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.