야매가 아닌 ,,,정식 라디오 선택값 합산
질문도 드리고 그래도 안되어서
이거 삽질끝에 어렵게 찾은 거에요
부득이 스택오버플로 진출하여,,ㅋ
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
0 <input type="radio" name="ur" value="0" id="ur1" class="radi"/> <br />
2 <input type="radio" name="ur" value="2" id="ur2" class="radi"/> <br />
0 <input type="radio" name="haem" value="0" id="haem1" class="radi"/><br />
1 <input type="radio" name="haem" value="1" id="haem2" class="radi"/> <br />
0 <input type="radio" name="haew" value="0" id="haew1" class="radi"/><br />
1 <input type="radio" name="haew" value="1" id="haew2" class="radi" /> <br />
0 <input type="radio" name="syb" value="0" id="syb1" class="radi"/><br />
1 <input type="radio" name="syb" value="1" id="syb2" class="radi"/> <br />
0 <input type="radio" name="orm" value="0" id="orm1" class="radi"/><br />
1 <input type="radio" name="orm" value="1" id="orm2" class="radi" /> <br />
Total: <input type="text" name="total" id="total"/>
$(".radi").click(function() {
var total = 0;
$(".radi:checked").each(function() { total += +this.value; });
$("#total").val(total);
});
출처:https://stackoverflow.com/questions/37135103/adding-radio-button-values-together-dynamically
댓글 3개
DawnDew
6년 전
감사합니다 스크랩해놓고 나중에 봐야겠네요. 잘 사용할께요
pororo
6년 전
감사합니다
4년 전
감사합니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4402 | ||
| 24 | 12년 전 | 7368 | ||
| 23 | 12년 전 | 5223 | ||
| 22 |
JMoon
|
12년 전 | 6243 | |
| 21 |
오늘도망했다
|
12년 전 | 13478 | |
| 20 | 12년 전 | 4319 | ||
| 19 | 12년 전 | 8044 | ||
| 18 | 12년 전 | 6510 | ||
| 17 | 12년 전 | 5413 | ||
| 16 | 12년 전 | 6131 | ||
| 15 | 12년 전 | 5612 | ||
| 14 | 12년 전 | 9228 | ||
| 13 | 12년 전 | 8197 | ||
| 12 | 12년 전 | 4948 | ||
| 11 | 12년 전 | 7265 | ||
| 10 |
|
12년 전 | 8958 | |
| 9 | 12년 전 | 7552 | ||
| 8 | 12년 전 | 8128 | ||
| 7 | 12년 전 | 7327 | ||
| 6 | 12년 전 | 7456 | ||
| 5 | 12년 전 | 7373 | ||
| 4 | 12년 전 | 7462 | ||
| 3 | 12년 전 | 6952 | ||
| 2 | 12년 전 | 5801 | ||
| 1 | 12년 전 | 12121 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기