1
给定一个下拉列表,是否有任何方法可以订阅JavaScript,甚至在将新项目添加到列表时会触发一个JavaScript?关于项目在下拉列表中添加事件(选项选择器)
我想类似以下工作
$("select").itemAdded(function(value, text) {
alert(text + " has just been added to the list of options");
});
$("select").append($("<option></option").val("1").html("Something"));
//results in alert of "Something has just been added to the list of options"
不完全确定为什么有人认为这应该是负面投票 - 我写的东西没有什么错,据我所知。 – Steerpike 2009-02-18 16:52:06