I have a dynamic form. Select selections with the same class but different identifiers.

$('.select_input'); 

How to find out all selected values ​​in select - elements of this class? This is how it outputs only 1 element var select = $('select.select_input');

Then, it is possible somehow, having learned the value of the element - to find out the id of the select select itself? For example, the first element is class = "select_input" id = "30" , the second is then class = "select_input" id = "31" , etc. (id = 32,33,34 ..) Is it possible to find out all these id, knowing only the class?

UPD In this cycle, I get the elements

enter image description here

 $.each($('select.select_input'), function (index, value) { console.log(value); }); 

Thus I receive selected select

  $.each($('select.select_input'), function (index, value) { values = value.value; console.log(values); }); 

Now I need to glue the value of select `a - 3 and 5, and from the value of id" get "the last digit - from id =" types_val0 "I need 0.

I get at the exit I need, on the screen - # 31 and # 51 enter image description here

ps

 $.each($('select.select_input'), function (index, value) { values = value.name; console.log(values); }); 
  • displays for some reason types_val, although it should in theory types_val0 / types_val1

1 answer 1

Better as it is more convenient to organize the connection between the data, now it is just a dense forest. Yes, and the meaning of the question is very vague. But, from what I understood here is an example:

 $('.select_input').each(function(){ var id = $(this).attr('id'); id = id[id.length-1]; console.log(id + '' + $(this).val()); })