How to choose a dynamic select?

0 like 0 dislike
3 views
Hi all, interested in the following question, I have two select on the page, when you select any element in the first select statement it makes ajax and generates the second select statement, i.e. I select country in the first system makes ajax and receives the region of the country (if any), on the first list, I make a choice like that
('#input-payment-country option[value="220"]').prop('selected', true); $('#tab-payment select[name=\\'country_id\\']').trigger('change');

and the question is, how do I get the data from the second select? if it forms a system dynamically and this is not an option
$('#input-payment-zone option[value="3495"]').prop('selected', true);

full code looks like this
$('#button-cart').on('click', function() { $('#input-payment-country option[value="220"]').prop('selected', true); $('#tab-payment select[name=\\'country_id\\']').trigger('change'); $('#input-payment-zone option[value="3495"]').prop('selected', true); });
by | 3 views

1 Answer

0 like 0 dislike
var secondValue = $(document).find('#second_select').val();
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Jun 6, 2019 by 4ekist
110,608 questions
257,186 answers
0 comments
33,700 users