비회원 댓글 달성시... 채택완료
비회원 댓글 달성시에
이름을 적고 비밀번호를 적는데, 비밀번호를 적게 되는 것으로 비밀글 사용에 자동적으로 체크되도록 할 수는 없나요?
<th scope="row"><label for="wr_password">비밀번호<strong class="sound_only">필수</strong></label></th>
<td><input type="password" name="wr_password" id="wr_password" required class="frm_input required" size="10" maxLength="20"></td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="wr_secret">비밀글사용</label></th>
<td><input type="checkbox" name="wr_secret" value="secret" id="wr_secret"></td>
제가 생각했을 때는
if (wr_password == " ") {
}
else
{비밀글 사용에 값을 넣어주는 것}
이렇게 될 거 같은데,
{비밀글 사용에 값을 넣어주는 것}
이부분을 어떻게 해야할지 모르겠네요
답변 2개
비밀번호 입력 시 자동 체크라면 view_comment.skin.php 파일에 아래처럼 넣어보세요.
</p><p><script>
$(document).ready(function(){
$("#wr_password").focusout(function(){
if($("#wr_password").val().length > 0) {
$("input:checkbox[id='wr_secret']").attr("checked", true);
} else {
$("input:checkbox[id='wr_secret']").attr("checked", false);
}
});
});</p><p></script></p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인