$("#showPassword").attr("checked")
提示undefied
改为
$("#showPassword").prop("checked")
<input οnchange="isCheck(this)" type="checkbox" />
function isCheck(oCtl){
$(oCtl).is(':checked')?alert("yes"):alert("no");
$(oCtl).prop('checked')?alert("yes"):alert("no");
}