Disable Links

Disable Links

I have a div where all the links need to be disabled. They are triggers for events so cannot be removed, but I don't want them to go to the url when the links are clicked.

So far I have this (very simple)
$('#maindiv a').click(function() {
return false;
});


Which doesn't work and I found this online
$("#maindiv a").click(function() { return false; });


But whichever I use, all links still go to the url

The target is actually div => ul => li => a => input

So not sure if I should be targeting better.

All help is greatly appreciated