[英]jQuery - detect if a select object has had options added or removed
I have a <select> object on the form. 我在表单上有一个<select>对象。 There are several methods in the app that can add and remove <option>'s to this <select> box. 应用程序中有几种方法可以向此<select>框添加和删除<option>。
I would like to detect when this add/remove happens. 我想检测何时发生添加/删除操作。 Not when an <option> has been selected (I know how to do this already). 选择<option>时不是(我已经知道如何执行此操作)。
try with the onChange method $("").onChange(); 尝试使用onChange方法$(“”)。onChange(); and this can solve your question 这可以解决您的问题
$("#yourSelectElement").on("DOMNodeInserted", function() {
// Code here
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.