IT노트(구)/JavaScript
(jQuery) input 태그를 readonly로 만드는 방법
스프링연구소
2015. 12. 15. 09:33
다음과 같은 text를 readonly로 만들고 싶다면
<input type="text" id="foo" value="foo">
다음과 같이 처리하면 된다!(jQuery를 사용하면 코드가 훨씬 더 간결해진다!)
$("#foo").prop("readonly", true); // readonly 활성화
$("#foo").prop("readonly", false); // readonly 비활성화