with javascript, I want to validate an array html like this:
i'm not sure I understand what you're trying to accomplish. this is a mix of html and javascript and wouldn't work. you can access the element with javascript by giving it an id: <select id="myId" name="exampleName">...</select> then in your head, use javascript to manipulate: //you can set the name to a value document.getElementById('myId').name = select_name[0]; //or you can read from it: if (document.getElementById('myId').name == select_name[0]) alert('hooray');
php, I can pick up several selects using the name of the select with "[]" will turn into an array automatically. But that does not work for javascript. The selects are generated dynamically. In this case, then I have to generate unique IDs for each select.
... and validate using id.
Join our real-time social learning platform and learn together with your friends!