4월, 2021의 게시물 표시

jquery input readonly [radio, select, checkbox]

텍스트 필드는 그냥 readonly 처리하면 된다 $("#id_text").prop("readonly", true); radio, select, checkbox 필드는 readonly 가 없기에 보통 disabled 처리하는데, 그러면, submit 에서 제외되기 때문에 form validation 에 문제가 생긴다. 그래서 이렇게 처리해준다. 체크되지 않은 radio 만 disabled $("#id_radio").not(":checked").prop("disabled", true); 선택되지 않은 option 만 disabled $("#id_select option").not(":selected").prop("disabled", true); 체크박스는 클릭 안되게 binding $("#id_checkbox").bind("click", false);