php - check if javascript var is equal to string -
i have php page verifies username users type in, , echo's "available!" if available div called "feedback". have javascript want check see if "feedback" div says "available! , echo "username good" "check" div if is. doesn't work , don't know why.
<script type='text/javascript'> function check_info(){ var username_good = document.getelementbyid('feedback').value; if(username_good == "available!"){ document.getelementbyid("check").innerhtml = "username good"; } else{ document.getelementbyid("check").innerhtml = "bad"; } } </script>
a div doesn't have value
property, need use innerhtml
:
var username_good = document.getelementbyid('feedback').innerhtml;
Comments
Post a Comment