티스토리 뷰
let isChecked = $('#takenBefore').prop('checked');
console.log(isChecked); // true (if checked at the time)
is() vs prop()?
So, what's the difference between is() and prop() in this context?
Both methods appear to work in much the same way from our perspective. So, what's the difference?
is() has a bit more overhead processing and parsing than prop(). Even considering the fact that prop() doesn't just access the property and does some validation, it's more performant when it comes to processing a large number of inputs, say, in a loop.
On the other hand - is() always returns a boolean value, whereas prop() just returns the underlying property's type. You can't guarantee that something else snuck in, and your code may fail at runtime if you don't use prop() properly. is() also semantically indicates the return value - a boolean, which makes it a more readable option.
참조 사이트 : https://stackabuse.com/how-to-check-if-checkbox-is-checked-in-jquery-and-javascript/
- Total
- Today
- Yesterday
- 스프링 프레임워크(spring framewordk)
- error-java
- 스프링 시큐리티(spring security)-http basic 인증
- 표현 언어(expression language)
- jsp 오픈 소스
- In App Purchase
- React
- 상품 등록
- java.sql
- .submit()
- 람다식(lambda expression)
- nl2br
- System.Diagnostics
- jstl(java standard tag library)
- java 키워드 정리
- 제품 등록
- java web-mvc
- 진수 변환
- REST API
- jstl(java standard tag library)-core
- 특정 문자를 기준으로 자르기
- 스프링 프레임워크(spring framework)
- 메이븐(maven)
- java-개발 환경 설정하기
- system.io
- MainActor
- await
- 스프링 시큐리티(spring security)
- 인텔리제이(intellij)
- 문자 자르기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |