This is a relatively straightforward task I’d like to accomplish without jquery or AJAX.
I have a couple javascript arrays A and B, and I have multiple rows in an HTML form that each contain two columns containing dropdowns which will each contain the contents of A and B. I’d like to populate every dropdown of a certain name with a predefined set of items. This can be done after the page has already loaded.
Any ideas as to what the javascript would look like? How can I address a slew of items named one thing?
This is the code for one of your arrays:
Your HTML should have a
<select id='myDropdown'></select>ready to go before this script is run. You can do the same process for the other array.Also, keep in mind that names
while IDs
So, make sure each of your dropdowns has a unique ID so your script can find it correctly.