document getelementid is returning null
<p>I am getting <code>document.getElementById("#toHide")</code> is null. How can solve this? how to convert this statement to jquery?</p>

<p>html:</p>

<pre><code>&lt;form wicket:id="safeForm" class="clearfix" /&gt;
&lt;div id="toHide" class="pb-text-align-center"&gt;
&lt;img id="loadingImg" src="my image location" style="margin-left: auto; margin-right: auto;"/&gt;
&lt;/div&gt;  
</code></pre>

<p>Java code creating JavaScript code in string buffer:</p>

<pre><code>if(flag == false){
    flag = true;
    buffer.append("$('#toHide').doTimeout(1000, ");
    buffer.append("function() { ");
    buffer.append("$('#").append(component.getMarkupId()).append("').submit(");     
    buffer.append(");");
    buffer.append("$('#toHide').html('&lt;img id=\"loadingImg\" src=\"../../img/load.gif\" style=\"margin-left: auto; margin-right: auto;\"/&gt;'); ");
    buffer.append("});\n");
    }
    else{
       buffer.append("\n document.getElementById(\'#toHide\').style.display='none';\n");    
    }
    buffer.append("&lt;/script&gt;");
</code></pre>

<p>2) i have declared flag=false at the global level. i am verifying for the first time for flag and allowing to enter if block shown above. But after this, image still display in next page. why? what changes i need to make?</p>
