title: javascript id select
body: <p>I have a javascript function that someone made for me. I am kind of a noob at raw javascript. I use jquery quite often so I have been spoiled. Right now the function runs when someone clicks anywhere on the page because the <code>document</code> selector is used to trigger the function. I want the function to run when a specific id is clicked. I do have jquery installed as well. Anyone have any suggestions?</p>
  
  <p><strong>addEvent('#id', 'click', function(){</strong> does not work</p>
  
  <p><strong>addEvent(document.getElementById("id"), 'click', function(){</strong> does not work</p>
  
  <pre><code>function addEvent(obj, type, fn) { 
    if ( obj.attachEvent ) {
      obj['e'+type+fn] = fn; 
      obj[type+fn] = function(){obj['e'+type+fn]( window.event );} 
      obj.attachEvent( 'on'+type, obj[type+fn] ); 
    } else 
      obj.addEventListener( type, fn, false ); 
  }
  addEvent(document, 'click', function(){
  </code></pre>