How to prevent the anchor tag to go to its URL

How to prevent the anchor tag to go to its URL

Hey guys
i have an anchor tag in .html page
<a id="add" onclick="javascript:openPage()">yes</a>
this openPage function is on another .js file and i i also added a code for preventing the the anchor thag when cliked to go to the url but do its task,

  1. var openPage=function(){
  2. location.href="http://localhost:8080/magento/index.php/checkout/cart/add?"+id+"&qty;=1";
  3. }
  4. $('add').bind("click",function(event) {
  5. event.preventDefault();
  6. /*var url = $(this).attr("href");*/
  7. var url="http://localhost:8080/magento/index.php/checkout/cart/add?"+id+"&qty;=1";
  8. $.get(url, function (resp) {
  9.     alert("Product added to cart");
  10. });
  11. });



but the above code..$('add').bind().. is not working. idont if i am doing something wrong.
Please help me out