【发布时间】:2017-02-09 05:09:39
【问题描述】:
我有一个编辑屏幕,其中有一个部分,其中有很多元素,如选择、输入等。现在我需要确定用户是否更改了使用 Jquery 已经存在的任何值。 我必须在提交表单时查找值是否发生变化。 考虑这样的 div,
<div class="row">
<div class="form-group required">
<label class="control-label">Port</label>
<select name="portId" id="portId">
<option value="">Select</option>
<option value="1">Chennai</option>
<option value="2">Kochi</option>
</select>
</div>
<div class="form-group required">
<label class="control-label">Operator Name</label>
<input type="text" id="operatorName" name="operatorName">
</div>
<div class="form-group required">
<label class="control-label">Attachment</label>
<input type="file" id="file" name="file">
</div>
【问题讨论】:
-
需要minimal reproducible example的HTML和你用过的jQuery。
-
您可以使用 on.input 事件跟踪文本更改,例如
$('<selector>').on('input',function(e){...}
标签: jquery