title: Onclick function based on element id
body: <p>I'm working on a site with a visualization of inheritance relation.</p>
  
  <p>I try to link each nodebox with specific URLs. The html of Element looks like this:</p>
  
  <pre><code>&lt;g class="node" id="RootNode" transform="translate(0,453.125)"&gt;
  </code></pre>
  
  <p>I used</p>
  
  <pre><code>$('#RootNode').click(function(){//do something}
  </code></pre>
  
  <p>and also</p>
  
  <pre><code>document.getElementById("RootNode").onclick(){//do something}
  </code></pre>
  
  <p>Neither of them can find the element, nor setup the onclick function.</p>
  
  <p>Have I misunderstood anything? Any information will be helpful. Thanks.</p>