PDA

View Full Version : Object [object HTMLDivElement] has no method 'set'



xiuping
27 Apr 2012, 5:14 PM
my code as follows:

var el=Ext.get('myToolbar').query('div.x-toolbar-inner');<br>
el.set('class','x-inner x-toolbar-wxp x-layout-hbox');

but logcat shows an error:Object [object HTMLDivElement] has no method 'set',<br>
why? anyone can help me solve the problem? thx

mitchellsimoens
30 Apr 2012, 6:58 AM
The reason is because it's not an Ext.Element as you need it to be. Plus, query is going to return an array of HTML elements. You will need to loop through that array, do an Ext.get on all elements before using set.