I have following html+ js code:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<a href="#" id=key onclick="func(0)">foo</a>
</body>
<script type="text/javascript">
function func(k){
alert(1);
return false;
}
</script>
</html>
Can you explain how to refactor following code that after click on href code func
executes but # doesn't add to the URL and page shouldn't be reload?