jquery - append parent div from within child divs -


i want add div before div 1, script nestled in few divs deep in code. work in theory?

<div id="1">    <div id="2">        <div id="3">            <style>            #4 {...}            </style>            <script src="//code.jquery.com/jquery-1.10.2.js"></script>            <script>                     $( "#4" ).before( $( "#1" ) );            </script>        </div>    </div> </div> 

thanks

this should inject div element before div id 1.

<div id="1">     <div id="2">         <div id="3">             <style>             </style>             <script src="//code.jquery.com/jquery-1.10.2.js"></script>             <script>               var $div = $('<div></div>').attr('id', '4');                  $div.insertbefore('#1');             </script>         </div>     </div>  </div>


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -