gpt4 book ai didi

javascript - 从动态生成的下拉列表中获取值

转载 作者:行者123 更新时间:2023-11-27 23:53:36 26 4
gpt4 key购买 nike

我正在尝试从第一个选择框访问某些值后填充的下拉列表中获取所有选定的值(ajax 调用)。

这是我迄今为止尝试过的,

$(document).on('change', '#modal', function(){
obj.push($('#modal').val());
});
console.log(obj);

#modal 是新填充的选择框的id

#make 是主 selectid

我也尝试过这两个

$('#make').on('change', '#modal', function(){

$('#modal').on('change', '#modal', function(){

但到目前为止还没有运气

PS。我正在使用 select2

最佳答案

填充选择后,您可以在 ajax 成功回调 中从 #modal select 检索选定的值。

例如http://jsfiddle.net/99hacq59/

关于javascript - 从动态生成的下拉列表中获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32476823/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com