A
A
Andrey Angelovich Stock2018-03-28 12:30:36
JavaScript
Andrey Angelovich Stock, 2018-03-28 12:30:36

How values ​​from table to array?

Hi all. there is a table that is formed by php, but in each row there are two cells with a select, which the user "fills" on his own. It is necessary by means of Jquery || js collect all select values ​​in an array. AS?

5abb609bde69d678731511.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2018-03-28
@KickeRockK

jQ /|\ JS
Go through the tags/classes you need and add values ​​to your (empty?) array.
Do you need it by submit or some other action to do? If yes, then run after submitting or fixing some.

A
Andrey Angelovich Stock, 2018-03-28
@your_uncle

var result = $("table select > option:selected").map(function(){ return $(this).text(); }).get();
console.log(result);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question