저는 css로 등급 시스템을 구축하고 있습니다.jQuery에서 다중 옵턴 입력을 감지합니다.
내 HTML 코드는 다음과 같습니다
<div class="rating">
<input type="radio" id="star5" name="rating" value="5" />
<label for="star5" title="Awesome..!">5 stars</label>
<input type="radio" id="star4" name="rating" value="4" />
<label for="star4" title="Pretty good">4 stars</label>
<input type="radio" id="star3" name="rating" value="3" />
<label for="star3" title="Ok!">3 stars</label>
<input type="radio" id="star2" name="rating" value="2" />
<label for="star2" title="Kinda bad">2 stars</label>
<input type="radio" id="star1" name="rating" value="1" />
<label for="star1" title="poor!">1 star</label>
</div>
및 jQuery를은 다음과 같습니다
$(function() {
$("div:has(input)").on("click", function (e) {
var value = $(":radio").attr('value');
alert(value);
});
});
하십시오 현재 var value
만 5 어떤 시작을 클릭에 인쇄되어
refer this JsFiddle. 하지만 내 출력에 정확한 값을 원해. 도움
http://jsfiddle.net/PSYKLON/CGP87/1668/ –