jquery select live onchange

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2548519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:46:30  来源:igfitidea点击:

jquery select live onchange

jquery

提问by Phillip Senn

I'm adding a select box to a form by cloning the current table row, and then doing

我通过克隆当前表格行向表单添加一个选择框,然后执行

currentRow.after(newRow);

Q: Using the .livemethod, how do I test to see when the new select option has changed?

问:使用该.live方法,我如何测试以查看新的选择选项何时发生变化?

回答by PetersenDidIt

$('table select').live('change',function(){
    var select = $(this);
    var newVal = select.val();
});