添加选项:

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");

 

相关文章:

  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-09-23
猜你喜欢
  • 2021-10-03
  • 2022-12-23
  • 2022-01-15
  • 2021-06-30
  • 2021-08-06
  • 2021-11-13
  • 2021-06-12
相关资源
相似解决方案