라디오 버튼 포커스 이동및 체크 기능
<p>dfsdfsfsfsf</p>
<ul id="chooseSource">
<li>
<input name="source" id="source1" type="radio" value="www" />
<label for="source1">slksdsdfsd</label>
</li>
<li>
<input name="source" id="source2" type="radio" value="w11122ww" />
<label for="source2">slksdsdeeeefsd</label>
</li>
<li>
<input name="source" id="source3" type="radio" value="w222342ww" />
<label for="source3">slksdsdeeeefsd</label>
</li>
<li>
<input name="source" id="source4" type="radio" value="w34422ww" />
<label for="source4">slksdsdeeeefsd</label>
<input name="source4txt" id="source4txt" type="text" />
</li>
</ul>
$("#chooseSource Input:text").each(function () {
var $inputTxt = $(this);
var $radioBtn = $inputTxt.siblings('input:radio');
$inputTxt.blur(function () {
if ($inputTxt.val() != '')
$radioBtn.attr("checked", true);
});
$radioBtn.change(function () {
if (this.checked)
$inputTxt.focus();
});
});
$('#chooseSource input:text').blur(function () {
if ($(this).val() != '') {
$(this).siblings('input:radio').attr('checked', true);
}
});
라디오 버튼 선택된 것 찾기
if ($("input[name=8011][checked=checked]").val() == "001") {
param.WRITER_CD = "8001";
param.WRITER_NM = "인사";
}
else {
param.WRITER_CD = "002";
param.WRITER_NM = "외부인사";
}
-------------------------------------------------------------------------------------------------------------------
라디오 버튼 체크
$("input[name=acc]:checked").val()
1. radio 버튼 에서 체크된 값 가져오기.
var mailTp = $(':radio[name="mailTp"]:checked').val();
2. radio 버튼 값 체크하기
$('input:radio[name=mailTp]:input[value='+mailTp+']').attr("checked", true);
-------------------------------------------------------------------------------------------------------------------
Repeater에서 row별로 라디오 버튼 있을 때 하나만 체크되게 하고 싶을 때
전체를 해제하고 하나만 선택하게 한다.
<input type="radio" id="rdoOne" name="group" onclick="radioOneCheck(this)" runat="server">
function radioOneCheck(ctrl) {
$("input[type='radio']").each(function () {
$(this).get(0).checked = false;
});
$(ctrl).get(0).checked = true;
}
'jQuery' 카테고리의 다른 글
XML문서 읽어 오기 (0) | 2015.09.01 |
---|---|
ListBox (0) | 2015.09.01 |
CHECKBOX 응용 기능 (0) | 2015.09.01 |
jquery 메서드 (0) | 2015.09.01 |
동일 이름의 여러개의 태크 검색및 사용 (0) | 2015.09.01 |
댓글