I defined a simple function and bound the click handler to the link using .bind ().
The function does not work on the click - rather, it works on the finished document. I don’t know why this is happening.
I am using jQuery 1.3.2.
HTML
<a href="#">click me</a>
JQuery
$(document).ready(function(){
leftTurn = function($message){
alert ($message);
};
$('a').bind('click', leftTurn('hello'));
});
The code is also here in JSFiddle
source
share