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);



이 블로그의 인기 게시물

반올림 올림 내림 버림(절사) 차이와 구현방법

럭스 원종희 인터뷰 (펌)

MSSQL->ORACLE 연결 TNS 에러