添加选项:

document.getElementById("id_select").options.add(new Option("name", "value"));

添加自定义的myVal值"value1"

document.getElementById("id_select").options[0].setAttribute("myVal", "value1");

获取自定义的myVal的值

document.getElementById("id_select").options[0].getAttribute("myVal");

 

相关文章: