Quantcast
Channel: bitPrison.net - Web development
Viewing all articles
Browse latest Browse all 23

jQuery link click href value

$
0
0

I've wrote these words on google. And I don't find the exact solution.

The problem:
What Should I write in the href? If I write # sign then browser go to the top of page. I wouldn't like to go to the top of page.

Here is the HTML:

<a href="#" id="example">Click</a>

jQuery code:

<script>
$('#example').click(function() {
  alert('Hello');
  return false;
});
</script>

The
return false;
command is the key. When use this return value. The links lost their default behavior.


Viewing all articles
Browse latest Browse all 23

Trending Articles