use span id value as a conditional javascript
<p>I have this span in the html body:</p>

<pre><code>&lt;span id="username_status"&gt;&lt;/span&gt;
</code></pre>

<p>snippet of sql query:</p>

<pre><code>if($exist &gt; 0)
    {
    echo 'Sorry, That username is Taken!'; //value in username_status
    }
    else{
    echo 'Username available!'; //value in username_status
    }
</code></pre>

<p>and i'm trying to use the query result to generate a form validation alert:</p>

<pre><code>var s1 = document.getElementById('username_status').innerHTML;
 if (s1 === "Sorry, That username is Taken!")
  {
  alert("Please Change Your Username. It is already used.");
  return false;
  }
}
</code></pre>

<p>I've searched far and wide, but it looks i'm not getting anything. any help?</p>
