Here span and font (coming from servlet) has the same id. So, you need to change font tag ids. Then you can use following modified version of your checkTeacherId() function:
function checkTeacherId() {
var status = $("#status").text();
if (status == "Id in use choose another")
return false;
else
return true;
}
Here I have used jQuery. $("#status").text() ignores all the html tags inside the span element and returns only the text. That means font tag will be ignored from span element and the text "Id in use choose another" or "Id Available" will be returned.