mootools - How to add a block of div contents in between two other divs using javascript only? -


i trying add div below

        <div id="topheader" class="topheader">             <ul>                 <li>                     <a href="#" title="library">library</a>                 </li>                 <li>                     <a href="#" title="my uni">my uni</a>                 </li>                 <li>                     <a href="#" title="staff intranet">staff intranet</a>                 </li>             </ul>         </div> 

in between 2 other divs

<div id="w3">  .... new div here ... <div id="head">  

i need done using javascript or motools , not jquery.

you can using inject

var headele = document.id('head');  new element('div', {     "class": 'topheader',     "id": 'topheader',     html: '<ul><li><a href="#" title="library">library</a></li><li><a href="#" title="my uni">my uni</a></li><li><a href="#" title="staff intranet">staff intranet</a></li></ul>' }).inject(headele, 'before'); 

here working js fiddle


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -