jQuery Apply to all but First

Glenn Glenn's Blog Leave a Comment

A quick snippit for you to apply jQuery selection to all but first element:-

<script type="text/javascript">
  $('ul.selector :not(:first-child)').each(function(){

As per our example this is useful in unordered / ordered lists and therefor menus etc. We are prepending a span with x2 spaces to every li except the first.

About the Author
jQuery Apply to all but First jQuery Apply to all but First 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g


A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.