Swapping <li> elements with replaceChild possible - Javascript jQuery

Javascript examples for jQuery:Select Dropdown

Description

Swapping <li> elements with replaceChild possible

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from  www .  j av a2  s.co m
$('#item2').insertBefore('#item1');
    });

      </script> 
 </head> 
 <body> 
  <ul id="mylist"> 
   <li id="item1">Item 1</li> 
   <li id="item2">Item 2</li> 
   <li id="item3">Item 3</li> 
  </ul>  
 </body>
</html>

Related Tutorials