<html><body><table border="1"><td><select><option value ="0">好</option> <option value ="1">较好</option></select></td><td><select><option value ="0">好</option> <option value ="1">较好</option></select></td></table></body></html>
You can use document.createElement("select");
This way to write a function
Specifically, you can google document.createElement, API
I don’t think there are any good improvements, it’s just ctl c, ctr v, and select has been used as an independent component, there is no What kind of integration is necessary
Moreover, if you use it as a form, it is not appropriate to put it universally here
At least I think what you call universal is just the reuse of data. It’s not select. If it’s just data, you can write a method to extract the drop-down options. When the page loads, just dynamically add the options to the select