-
17 Apr 2012 12:05 AM #1
Answered: Array
Answered: Array
Hi
var xyx=Ext.DomQuery.select('div.hiddenfield');
Ext.Array.each(xyx,function(i){
i.addClass('item-selected');
});
Uncaught TypeError: Object #<HTMLDivElement> has no method 'addClass'
Please tell me where i am wrong..
-
Best Answer Posted by AndreaCammarata
That's because the "addClass" has been renamed to "addCls".
Let's use "addCls" and everything will works fine.
-
17 Apr 2012 2:35 AM #2
Hi,
the problem here is that the "Ext.DomQuery.select" function returns you an HTML element and not an Ext.Element, this is why you get that error message.
For this reason, if you want to use the "addClass" method, you should get the Ext.element associated to every HTML element you've got as follow:
Hope this helps.Code:var xyx=Ext.DomQuery.select('div.hiddenfield'); Ext.each(xyx,function(i){ Ext.get(i).addClass('item-selected'); });Sencha Inc
Andrea Cammarata, Solutions Engineer
CEO at SIMACS
@AndreaCammarata
www.andreacammarata.com
github: https://github.com/AndreaCammarata
-
17 Apr 2012 4:04 AM #3
TypeError: Object [object Object] has no method 'addClass'
Still error is there..
-
17 Apr 2012 4:17 AM #4
That's because the "addClass" has been renamed to "addCls".
Let's use "addCls" and everything will works fine.Sencha Inc
Andrea Cammarata, Solutions Engineer
CEO at SIMACS
@AndreaCammarata
www.andreacammarata.com
github: https://github.com/AndreaCammarata


Reply With Quote