using getelement by id instead of name
<p>Been trying to see how flexible this is. <a href="http://jsfiddle.net/PJSha/4/" rel="nofollow">http://jsfiddle.net/PJSha/4/</a> i have changed the get element from Name to ClassName which both worked but does not work when i try and achieve it with Id... is there a reason</p>

<p>Code:</p>

<pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all" /&gt;

&lt;input type="text" id="foo" class="bar" name="domain"&gt;
&lt;div onclick="check_domain_input()"&gt;Click&lt;/div&gt;

&lt;div id="dialog" title="Attention!" style="display:none"&gt;
    Please enter a domain name to search for.
&lt;/div&gt;

&lt;script&gt;
    function check_domain_input()  {        
        var domain_val = document.getElementById('foo');

        if (domain_val[0].value.length &gt; 0) {
            return true;
        }

        $( "#dialog" ).dialog();

        return false;
    }
&lt;/script&gt;
</code></pre>
