Refer to this fiddle:
HTML:
<input type="password" id="Password" tabindex="2">
<input id="PasswordChk" type="checkbox" disabled="disabled"/>
JS:
$('#Password').on("keyup", function () {
var password = $.trim($(this).val());
if(password.length == 0){
$('#PasswordChk').removeAttr("checked");
}else{
$('#PasswordChk').attr("checked", "checked");
}
});
When I first type into the textbox, the checkbox is set. When I remove the text (length = 0) it's unchecked.
However after unchecking, it can't re-check the checbox.
Anyone know how to get around this?