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
Post a Comment