tags:

views:

46

answers:

2
$('a').bind('click',function(e){
alert("hi");
});

with some sites, it fails. that is until i reload it again, it works.

why does this seem to happen ?

+3  A: 

Is it in $(document).ready(function() { so that it waits till the page is fully loaded?

griegs
A: 

You may also want to check out the .live keyword as in

$("a").live("click", function

as this will bind the click event even if you add the control after a partial postback.

griegs