JSFiddle - React, Tailwind, and code Playground

by mohammad_erdin

HTML

<link rel="stylesheet" href="http://docs.sencha.com/ext-js/4-0/extjs-build/resources/css/ext-all.css">
<p>
    surrounding text
</p>
<p id="iShouldBeInsideTheBox">
    This should be inside the box
</p>
<p>
    surrounding text
</p>
<p id="box">
    Some content in the box
</p>

<button id='toggle'>Toggle</button>

CSS

#box{
   border: 1px solid #000;        
}

JavaScript

function toogle(){
if (Ext.query("#box #iShouldBeInsideTheBox").length)
    Ext.get('iShouldBeInsideTheBox').insertAfter(Ext.getBody().child("p"))
else
    Ext.get("box").appendChild(Ext.get('iShouldBeInsideTheBox'))
}

Ext.get("toggle").addListener("click",toogle)