get all values in hidden field with the same name

Solutions on MaxInterview for get all values in hidden field with the same name by the best coders in the world

showing results for - "get all values in hidden field with the same name"
Valentina
24 May 2020
1<!--html-->
2<input type="hidden" name="customerID" id="customerID1" value="aa190809" />
3<input type="hidden" name="customerID" id="customerID2" value="aa190810" />
4<input type="hidden" name="customerID" id="customerID3" value="" />
5
6<script>
7$("input[name=customerID]").each(function(){
8    //get attributes
9    console.log(this.id + " with value: " + this.value);
10    
11    //set values
12    if (this.value == "") {
13      this.value = "my new value";
14    }
15    
16});
17</script>