zeptojs에서 select에서 선택한option의 값을 가져옵니다.
첫 번째 방법
// get OPTION elements for which `selected` property is true
$('option').not(function(){ return !this.selected })
문제
:$(‘option[selected]’) only finds options that have their selected attr set in the html.It does not find values the the user has selected themselves.
결론:
This is expected behavior. Such CSS selectors match attribute values, which don’t change with user interaction. Theselected property of the element changes, but attribute doesn’t.
두 번째 방법
$("#ID").val() value
$("#ID option").eq($("#ID").attr("selectedIndex")).text()
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Nginx · 자동 스 크 립 트 편 해부 (1) 설정 스 크 립 트 분석 auto / options예 를 들 어:auto/options 매개 변수 값 부여 case-esac prefix 매개 변수 값 부여 NGX_PREFIX sbin-path 매개 변수 값 부여 NGX_SBIN_PATH conf-path 매개 변...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.