상세 컨텐츠

본문 제목

[javascript] 원하는 select option의 selected 처리

헉!!/javascript

by 권태성 2013. 4. 23. 10:43

본문

select option들 중에 원하는 option에 selected 속성을 넣어주는 방법 입니다.


var target = document.getElementById('selectList');   //대상 셀렉트 id

target.options[idx].selected = true;   //options에 대상 option의 index를 넣으시면 됩니다.





관련글 더보기