PDA

View Full Version : Uncaught TypeError: Object function getElementById() { [native code] } has no method



euniceadu
29 Aug 2012, 4:04 AM
I am getting an error in my javaScript code. I created a ExtJs button and assigned a handler to it. The handler creates a ExtJs messageBox. The problem is, when the button is clicked, the messageBox is not created. When I used Chrome to debug I got this error:

"Uncaught TypeError: Object function getElementById() { [native code] } has no method 'addEventListener'"


I have searched around but so far got nothing. Below is the code:


var fBtn1 = new Ext.Button({
text: 'Forward',
tooltip: 'Send this message to more recipients',
handler : getBox
});


function getBox() {
Ext.MessageBox.confirm('hello', 'how is it');
}

willigogs
29 Aug 2012, 4:54 AM
Use Firefox with FireBug installed, as that will provide much better debugging.

scottmartin
29 Aug 2012, 7:24 AM
Are you rendering the button to another container, or the body?



var fBtn1 = new Ext.Button({
text: 'Forward',
tooltip: 'Send this message to more recipients',
handler : getBox,
renderTo: Ext.getBody()
});


function getBox() {
Ext.MessageBox.confirm('hello', 'how is it');
}?


Scott.