Skip to content
Advertisement

How to get multiple values from input field in jquery?

I want to get input field values which are in foreach loop using jquery . Here is the html structure

JavaScript

I’m trying to get value in this way

JavaScript

But In this way, I get only first-row value. How can get all rows value using jquery?

Advertisement

Answer

You have to loop through all the elements to get the values from them.

You can try jQuery’s .map() and .get() to get all the values in an array.

Demo:

JavaScript
JavaScript

Update: As mentioned in the comment: get values by row

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement