Monday, October 4, 2010

Use Jquery to change onclick event dynamically

$('#foo').onclick = "" doesn't seem to work

Query:

$('#foo').click(function() { alert('foo'); });

Or if you don't want it to follow the link href:

$('#foo').click(function() { alert('foo'); return false; });

No comments:

Post a Comment