-
25 Aug 2011 6:27 AM #1
Answered: Prevent default button action for HTML button
Answered: Prevent default button action for HTML button
I would like to know how to prevent the default action for an HTML button click event.
My code is as follows:
I debugged the event handler, and I saw that the Ext.get('copyShippingToBilling') was returning Ext.util.Animate which doesn't have a preventDefault() method.Code:Ext.get('copyShippingToBilling').on('click', function () { // Do something // Prevent/cancel click event });
So my questions are:- Why am I getting an Ext.util.Animate returned? I was expecting a Ext.button.Button to be returned.
- How do I prevent the default behaviour of the button click?
-
Best Answer Posted by arthurakay
Ext.get() returns an Ext.Element(). Your button is an HTML DOM element, so it will never reference anything related to an ExtJS button component. Very different things.
look at the API docs for the "click" event on Ext.Element. The first argument is the event object you want... it should have the preventDefault() method.
-
25 Aug 2011 7:11 AM #2
Ext.get() returns an Ext.Element(). Your button is an HTML DOM element, so it will never reference anything related to an ExtJS button component. Very different things.
look at the API docs for the "click" event on Ext.Element. The first argument is the event object you want... it should have the preventDefault() method.


Reply With Quote