1

I am using Rapheael to draw a control Dashboard. Right now I am adding a hyperlink object into the Dashboard editor. It is a text with the HREF attribute. When I add the element and click on it, it opens the link. Is there some way to temporarly disable the link? When I click the other elements, it opens the property dialog. I would like that also with the Hyperlink object.

I've tried adding return:false, but didn't help:

obj.dblclick(function (event) {
        jQuery('##divProperties').dialog('open');
        return false;
    });     
Jed Watson
  • 20,150
  • 3
  • 33
  • 43
Kokesh
  • 3,165
  • 7
  • 29
  • 46

1 Answers1

1

Returning false is a way to cancel events with more traditional event binding, e.g.

obj.onclick = function() { return false }

or

<a onclick="return false;"></a>

But it doesn't work with jQuery event bindings.

To do that, you need to call the .preventDefault() method on the event object, which is passed to the event handler:

obj.dblclick(function (event) {
        jQuery('##divProperties').dialog('open');
        event.preventDefault();
    });

You may want to prevent default on the click event also if you're capturing double click so it doesn't get fired either.

Jed Watson
  • 20,150
  • 3
  • 33
  • 43