How do I programmatically set the value of a select box element using JavaScript?

后端 未结 17 1971
轮回少年
轮回少年 2020-11-22 06:33

I have the following HTML

17条回答
  •  半阙折子戏
    2020-11-22 07:00

    function setSelectValue (id, val) {
        document.getElementById(id).value = val;
    }
    setSelectValue('leaveCode', 14);
    

提交回复
热议问题