title: Javascript preventDefault operation
body: <p>I'm just practising some JavaScript and I came across an error I can't get around. I have a list in my html where each item links to a page, but
  I have a function in my js script where when I click the item its supposed to remove the item from the list, I'm trying to use <code>preventDefault()</code> but it still takes me to that link.</p>
  <pre><code>&lt;ul id=&quot;shoppingList&quot;&gt;
          &lt;li class=&quot;complete&quot;&gt;&lt;a href=&quot;google.com&gt;&lt;em&gt;fresh&lt;/em&gt;tuna&lt;/a&gt;&lt;/li&gt;
          &lt;li class=&quot;complete&quot;&gt;&lt;a href=&quot;google.com&quot;&gt;meatball&lt;/a&gt;&lt;/li&gt;
          &lt;li class=&quot;complete&quot;&gt;&lt;a href=&quot;google.com&quot;&gt;kiwi&lt;/a&gt;&lt;/li&gt;
          &lt;li class=&quot;complete&quot;&gt;&lt;a href=&quot;google.com&quot;&gt;chicken soup&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt; 
  
  function getTarget(e){
  if(!e){
      e = window.event;
  } 
  return e.target || e.srcElement;}
  
  function itemDone(e){
  //Remove item from the list
  var target;
  var Parent;
  var Grandparent;
  target = getTarget(e);
  Parent = target.parentNode;
  Grandparent = target.parentNode.parentNode;
  Grandparent.removeChild(Parent);
  
  //Prevent the link from taking you somewhere
  if(e.preventDefault){
      e.preventDefault();
  }else{
      e.returnValue = false;
  }
  }
  
  //Set up event listeners to call ItemDone() on click
  var Shoppo = document.getElementById('shoppingList');
  if(Shoppo.addEventListener){
  Shoppo.addEventListener('click',function(e){
      itemDone(e);
  },flase);
  }else{
  Shoppo.attachEvent('onClick',function(e){
      itemDone(e);
  });
  }
  </code></pre>