Delete first list element using jQuery - Javascript jQuery

Javascript examples for jQuery:List

Description

Delete first list element using jQuery

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.8.3.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*w w w. ja  va 2s . c  om*/
$('#list li').first().remove();
    });

      </script> 
 </head> 
 <body> 
  <ul id="list"> 
   <li>1</li> 
   <li>2</li> 
   <li>3</li> 
   <li>4</li> 
   <li>5</li> 
   <li>6</li> 
  </ul>  
 </body>
</html>

Related Tutorials