click 이벤트 추가 질문 드려요

click 이벤트 추가 질문 드려요

QA

click 이벤트 추가 질문 드려요

답변 2

본문

<input type="checkbox" name="" id="chk"> 를 체크 하기 전에는


폼안에 input / select / textarea 게 disabled 상태이고


<input type="checkbox" name="" id="chk"> 체크하면 


입력이나 선택 가능하게 할려면 어떻게 해야 될까요~ ?


<form name="fwrite">


...


</form>

이 질문에 댓글 쓰기 :

답변 2


<input id="id1" value=""  onclick="ableThis()" disable>


<script>
function ableThis(){
 $("#id1").removeAttr( "disable" ); 
 $("#id1").focus(); 
}

</script>
 

질문의 전달이 좀 잘못되었네요.

폼 밖에 <input type="checkbox" name="" id="chk"> "입력가능" 이란 체크박스를 클릭시

폼 안에  input / select / textarea 가 일괄적으로 disabled & 해제 가 되었으면 하는 거거든요

var forms = $('[name=fwrite]').find('input, select, textarea').prop('disabled', true);

$('#chk').on('change', function() {

  if (this.checked) {

    forms.prop('disabled', false);

  } else {

    forms.prop('disabled', true);

  }

});

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 11
© SIRSOFT
현재 페이지 제일 처음으로