"Catch" name of a textbox in html with javascript

-2

I have a table where is a textbox that increases depending on the result of the query, what I want is to trap the name with the for loop:

<input type="text" name="tname" value="1"> 
<input type="text" name="tname" value="2">
<input type="text" name="tname" value="3"> 
<input type="text" name="tname" value="4">
    
asked by Leonardo Rodríguez 19.04.2018 в 00:13
source

1 answer

0

This was what I needed:

$(function() {
    var values = $('input[name="text[]"]').map(function() {
        return this.value
    }).get()
    console.log(values)
})

I got it here: link , I'm sure I did not ask what I wanted.

    
answered by 20.04.2018 в 18:15