简体   繁体   中英

Using a select drop down list more than once

I am looking for a way to use some drop down lists more than once in a website (sometimes it will be more than once on the same page, others from a different page). This is in HTML 5, with javascript. Any suggestions on where to start looking?

jQuery would be a good start. You can easily clone and paste DOM elements with jQuery. If you can't use jQuery I would suggest checking out the cloneNode method.

You'll probably want a model-view pattern that separate the rendering (view, in your case the select element) from the data (model, in your case the list of options).

You could start by looking at popular libraries like Ember or Angular.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM