Let’s say we want to disable all the links on a page, using jQuery we just have to return false from the click handler:
jQuery(function(){
jQuery('body a').click(function(){
return false;
});
});
Using Prototype, we pass the event instance to Event.stop():
document.observe("dom:loaded", function(){
$$('body a').each(function(a, num){
$(a).observe('click', function(e){
Event.stop(e);
});
});
});
With everyday Javascript, we again return false from the click handler:
window.onload = function(){
elements = document.getElementsByTagName('a');
for (var i = 0; i < elements.length; i++){
elements[i].onclick = function(){
return false;
}
}
}