T
T
tigra2015-10-30 17:05:11
JavaScript
tigra, 2015-10-30 17:05:11

How to fill an array in each?

$('.fields .services').each(function() {
   var field = $('select option:selected', this).text() + ';' + $('.sum-input', this).val();
         var fields = array();
   alert(field);
      });

this code runs through all the inputs and displays their values ​​in the format

Internet representation; 36300
promotion; 3400, etc.

How can I fill these lines into the fields array?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rakro, 2015-10-30
@tigroid3

fields.push(field)

S
Super User, 2015-10-30
@sergeystepanov1988

Maybe we should not reinvent the wheel, but take a ready-made serializeArray() method ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question