document.getElementById() not working
<p>I've seen other posts with the same title. 
<a href="https://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element">Why does jQuery or a DOM method such as getElementById not find the element?</a> does not apply.
I am not looking for the ID before the html is loaded. Here is the whole file:</p>

<p><a href="https://jsfiddle.net/2uxqmsth/" rel="nofollow noreferrer">https://jsfiddle.net/2uxqmsth/</a>
If you click on the link - the function is called.
The relevant javascript is below:</p>

<pre><code>    function getNewComment() {
        var xd = document.getElementById('#xdialog');

        if ( xd === null ) alert( 33 );
        else alert( 22 );
    }
</code></pre>