[英]How to trigger onchange event of all input at once?
假设我有一个在单击特定按钮时自动创建或生成的输入...
假设生成的输入是......
<input class='myinput' type='text' onchange='functionName($id,this.value)' />
<input class='myinput' type='text' onchange='anotherFunctionName($id,this.value)' />
<input class='myinput' type='text' onchange='newFunctionName($id,this.value)' />
<input class='myinput' type='text' onchange='anotherNewFunctionName($id,this.value)' />
<input class='myinput' type='datetime-local' onchange='...($id,this.value)' />
<input class='myinput' type='text' onchange='...($id,this.value)' />
<input class='myinput' type='text' onchange='...($id,this.value)' />
<input class='myinput' type='datetime-local' onchange='...($id,this.value)' />
...
这些输入具有不同的类型,并且在OnChange
事件上调用了特定的函数。 有时它不需要更改值,我的问题是它只会保存OnChange
事件上的数据。
是否可以使用 javascript 或 jquery 一次在这些输入上触发OnChange
事件?
Jquery:
$('input[type=text]').trigger('change');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.