hey guys!
how can i create a element in dom like document.createElement('div'); ?
ive read the Ext.Element documentation, but i cant figure out how the correct syntax is..
please help me
thanks![]()
hey guys!
how can i create a element in dom like document.createElement('div'); ?
ive read the Ext.Element documentation, but i cant figure out how the correct syntax is..
please help me
thanks![]()
There are multiple ways, but I usually use the DomHelper class to do so:
Code:Ext.DomHelper.append('parent-div', {tag: 'div', cls: 'new-div-cls', id: 'new-div-id'});
thank you for your quick response, but iam looking for the method to create an element directly, like document.createElement, after that i want to append it somewhere..
thank you although![]()
Ah, same way you'd create it with document.createElement:
Later on you can put it wherever you want with Ext.Get('par-div').appendChild(myEl.dom)Code:myEl = new Ext.Element(document.createElement('div'));
thanks![]()
Given:
Is there also a way to use the ext object like this?myEl = new Ext.Element(document.createElement('div'));
Ext.Get('par-div').appendChild(myEl.dom)
Ext.Get('par-div').appendChild(myEl)
Yes. appendChild works with Elements, strings, HTMLElements.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
Thanks.
what if the parent div is a class.What is the syntax to add a child node to aparentdiv class?