Horje
get all values in hidden field with the same name Code Example
[Solved] - get all values in hidden field with the same name Code Example
Try following codes
get all values in hidden field with the same name
<!--html-->
<input type="hidden" name="customerID" id="customerID1" value="aa190809" />
<input type="hidden" name="customerID" id="customerID2" value="aa190810" />
<input type="hidden" name="customerID" id="customerID3" value="" />

<script>
$("input[name=customerID]").each(function(){
    //get attributes
    console.log(this.id + " with value: " + this.value);
    
    //set values
    if (this.value == "") {
      this.value = "my new value";
    }
    
});
</script>
Date: 2022-05-21 05:02:10
Category: html
More for You