I have a question regarding how to access an index from a model attribute list dynamically. In my code, I have some javascript which is reading a value from a model. The model has an attribute which is potentially a list.
document.getElementById("phoneNumberRPhone").value = "${model.people[index].phoneNumber.number}";
Here, you can see that I'm trying to set a javascript value to a number retrieved from a model where I can have multiple people. Index is my dynamic value. It works fine if I specifically state model.people[0] or model.people[1], but if I try to set a number to index and use index dynamically, it no longer works.
I would be very grateful for any help anyone could provide on this. I'm certain it's either just a matter of user error or improper use of syntax.