티스토리 뷰
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
- Task
- 공백제거
- mssql
- 제품 등록
- FileUpload
- System.Diagnostics
- trim
- html tag
- .submit()
- 명령어
- async
- 특정 문자를 기준으로 자르기
- 문자 자르기
- nl2br
- App Store
- system.io
- 앱 스토어
- MainActor
- hyper-v
- 상품 등록
- In App Purchase
- await
- 진수 변환
- 아이폰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |