PDA

View Full Version : add element to html?



nofx
12 Sep 2011, 11:11 PM
Hi, i was wondering if it's possible to add a div for instance to some html.

Example, suppose i have this:

var mydiv = '<div class="mydiv">Hi</div>';

Is there a way to add this div to my html page? Something like:

Ext.getCmp('anotherDiv').add(mydiv);

And i dont want to add inside the 'anotherDiv' element. But after it. Like jQuery can do: http://api.jquery.com/after/

edspencer
13 Sep 2011, 10:00 PM
Assuming you're not actually injecting it into a Component (you're using getCmp above where I think you mean to use get), you should be able to do this:



Ext.get('anotherDiv').insertHtml('after', myDiv);