View Full Version : Real basic: how to cancel click event

20 Aug 2010, 11:45 AM
Should be simple. Isn't. The a tag has an href, so the browser wants to follow the link. I don't want it to. Instead I want to load the href via an AJAX call.

Ext.onReady ( function () {
Ext.BLANK_IMAGE_URL = "/js/extjs/resources/images/default/s.gif";

Ext.select ("div#topmenu ul li a").on ("click", (
function (e, t) {
e.cancelEvent(); // doesn't work
return false; // doesn't work either

I'm hoping to eventually replace this bit of jQuery code with an Ext equivalent:

$(function() {
$("div#topmenu ul li a").click ( function() {
$("div#middle").fadeOut ("slow").hide().load (
function() { $("div#middle").fadeIn("slow"); }
$("a.active").removeClass ("active");
return false;

but I can't even get past handling the click properly, which is frankly pretty discouraging.

20 Aug 2010, 11:54 AM
Crap. Of course I screwed it.

e.stopEvent() not e.cancelEvent().