How do I determine the state of a checkbox (i.e. checked or unchecked) with the following code:
function deleteItems() {
var items = $('.td_checkbox');
for (var item in items) {
// this doesn't work
if ($(item).is(:checked) == true)
alert('delete my div if checked!');
}
}
You need quotes around :checked, but I also don’t think your loop works correctly.
This will do what you want (use each() rather than for item in items)