jquery select first index (1) 썸네일형 리스트형 [JQuery] select 박스 첫 번째 인덱스로 바꾸기 Form 전송을 하고나서 모든 값을 초기화 할 일이 생긴다. input이나 textarea는 view plaincopy to clipboardprint?$('input').val(''); $('textarea').val(''); 을 사용 해서 빈 칸으로 만들어주면 되는데 select는 그렇지 않다. 아래와 같이 작성하면 모든 select 요소를 첫 번째 인덱스로 설정한다. view plaincopy to clipboardprint?$('select').find('option:first').attr('selected', 'selected'); 셀렉터를 $('select option:first') 로 하지 않는 이유는 첫 번째 select 요소만 바꾸기 때문이다. 이전 1 다음