1. radio 버튼 에서 체크된 값 가져오기


var mailTp = $('input:radio[name="mailTp"]:checked').val();



2. radio 버튼 값 체크하기


$('input:radio[name=mailTp]:input[value='+mailTp+']').attr("checked", true);





-----------------------------------------------------------------


...


<tr>

<td WIDTH="13%" class="tb_brw_tt">메일</td>

<td WIDTH="20%" class="tb_w_tt" colspan="3">

<input type="radio" name="mailTp" value="01"> 발송

<input type="radio" name="mailTp" value="02"> 미발송

</td>

</tr>



...


-----------------------------------------------------------------






radio, checkbox 값 check 


$("#open2").attr("checked", 'checked');

$("#emailChk").attr("checked", 'checked');
$("input[name=emailChk]").attr("disabled",false);


// emailChk 체크되어 있는지 유무 파악
var emailChk = $("input:checkbox[id='emailChk']").is(":checked");




-----------------------------------------------------------------

...

<input name="emailChk" id="emailChk" type="checkbox" />

<input name="publicYn" id="open1" type="radio" value="Y" checked /> 공개
<input name="publicYn" id="open2" type="radio" value="N" /> 비공개

...

-----------------------------------------------------------------







- radio default checked 강제 click trigger

$('input:radio[name=useYn]:input[value=N]').attr("checked", true).trigger("click");



+ Recent posts