0

I'm having problems understanding how preventDefault function works. I created a simple jsfiddle, but still, selections and expansion works and not prevented.

http://jsfiddle.net/XRfKb/15/

Any help is appreciated, thanks.

EDIT: How to prevent selection if page is not valid? Here's a piece of code:

panelBar.bind("select", function (e) {
   //some code here
   if (!isValid) {
            e.preventDefault(e); //doesn't work
            //this.select('#firstStep'); //doesn't work
        }
    });
4

2 回答 2

2

Indeed, you're using an old release from the last year. I've updated your jsFiddle accordingly: http://jsfiddle.net/XRfKb/18/

Currently the select event can't be prevented. As of next release the select event can prevent link navigation, but not the actual selection of the item. We may consider preventing selection too.

于 2012-06-23T07:18:46.887 回答
0

I ended up by using simple "click" events for links in the PanelBar instead of "select" events for PanelBar.

e.preventDefault and e.stopPropagation work fine for them.

于 2012-06-26T21:28:22.377 回答