I’m working on creating a basic Naming Convention app. I’ve created a basic structure for it. The form
has select
elements and from dropdown, user will pick the best suitable option
.
But there’s one select element that has over 300+ different option. And using them in index.html is a lot of lines and readibility is horrible. Is there any way I can get option’s from another file so that my html file would look clean?
Thanks in advance 🙂
I’ve searched online but none of those solutions resolved my problem. I just want a basic solution.
2
Answers
Main html file:
Included content (b.html) :
You can put your select options to the template at the bottom of the index page. Then use JavaScript to populate the list.
In practice, however, such a long list of options is populated using server-side templates or dynamically loaded content. The solution depends on the technological stack. If you develop a small web application that will be hosted on a web server, you might want to consider JavaScript fetch function.
Index.htm:
List.htm: