Reputation: 4445
I'm trying to get all selected
values from dropdown
that is being populated after accessing some value from first select box
(ajax
call).
here what I've tried so far,
$(document).on('change', '#modal', function(){
obj.push($('#modal').val());
});
console.log(obj);
#modal
is the id
of newly populated select
box.
#make
is the id
of main select
.
I've tried these two as well
$('#make').on('change', '#modal', function(){
and
$('#modal').on('change', '#modal', function(){
but no luck by far
PS. I'm using select2
Upvotes: 1
Views: 611
Reputation: 1065
You can retrieve the selected
values from your #modal select
in your ajax success callback
after populating the select.
For example http://jsfiddle.net/99hacq59/
Upvotes: 1