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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -