Reputation: 5757
I have 10 dropdown menus on a page, each dropdown menu has about 30 items.
This takes up a ton of lines of code, and even impedes page loading time by a small amount.
A. Is there a way to simplify the amount of code that contains these dropdown menus?
B. Is there a way to improve this pages performance?
Upvotes: 0
Views: 765
Reputation: 81
You can check this cool plugin for dropdown menu, it may help you construct your code better, http://twitter.github.com/bootstrap/javascript.html#dropdowns
If you really have a huge menu, you may consider make your menu items into a javascript Array or Object, the use javascript function to render the menu rather than plain HTML code to save page size.
Upvotes: 1
Reputation: 195
If each one of the dropdown menus has a certain type of data so lets say animals or trees e.t.c you could create a database and dynamically pull them into a dropdown menu. it would be some what quicker than than trying to manually load them all at one. Using this method would simplify the process a lot and also make it more dynamic to add new options if u like i can write you up some basic code to get you started??
Upvotes: 0
Reputation: 9957
Did you try to exchange the select fields with autocomplete input fields fed by an ajax call?
There are some advantages to this approach:
Less HTML code
Faster page load
User friendly
Upvotes: 0