Use prop(checked), not attr(checked)