Prop2 [Jquery] input[type="checkbox"]의 체크 여부 input[type="checkbox"]의 체크 여부를 3가지 형태로 확인 할 수 있다. 1. :checked 선택자 사용 See the Pen Untitled by 조민혁 (@iqgzrljw-the-typescripter) on CodePen. 2. prop() 매서드 사용 See the Pen Untitled by 조민혁 (@iqgzrljw-the-typescripter) on CodePen. 3. 체크 박스 전체동의 See the Pen Untitled by 조민혁 (@iqgzrljw-the-typescripter) on CodePen. +) prop()는 프로퍼티 값을 반환하므로 더 정확한 체크 상태를 확인 할 수 있다. 2023. 10. 26. [Jquery] attr()과 prop()의 차이 📌attr() , prop() ? element에 특정한 속성을 지정하게 되는 경우에 attr()과 prop()을 사용한다. attr() => attribute(속성) prop() => property(속성) 📢 attr()과 prop()의 차이점 attr()은 속성 그 자체의 값을 반환하고, prop()은 속성값을 명시적으로 찾아낼 수 있는 방법을 제공 📢 attr() vs prop() 결과값 .attr('checked') : checked .prop('checked') : true .is(':checked') : true 📢 attr() attribute값을 가져오거나 설정할때 사용 var className = $("#userName").attr("class"); // 클래스 값 가져오기 $("#us.. 2023. 9. 13. 이전 1 다음