일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- RESTful
- REST
- node.js
- Lodash
- Travis CI
- javascript
- ubuntu
- sanghaklee
- java
- Linux
- Gitbook
- GIT
- 개인정보수정
- sinopia
- {}
- ATOM
- API
- python
- PowerMock
- AWS
- ECMAScript2015
- Code-coverage
- JaCoCo
- dict
- nginx
- Coveralls
- primitive type
- NPM
- Unit-test
- 인프런
Archives
- Today
- Total
이상학의 개발블로그
[jQuery] select tag option 모든 값 가져오기 본문
select tag의 모든 값 가져오기
Get all options values of select tag
Code
$('#select').find('option').map(function() {return $(this).val();}).get()
// return []
$('#select option')과 같은 표현식도 가능하지만, 각 DOM 객체를 확실히 표현하기 위해 나눠서 사용했다.
.get()
마지막에 .get()을 하지 않으면 select tag의 모든 jQuery가 순회할 수 있는 properties를 가져온다.
따라서, 값만 가져오는 .get()
을 꼭 넣어준다.
Codepen
See the Pen get select-box value by Sanghak,Lee (@SangHakLee_1470355178) on CodePen.
Comments