Jquery first child

Posted on 2014-07-25
Last Modified: 2014-07-25

I want to apply a click event to all child list items  in an undordered list other than the first child. how can i achieve this?

Question by:coolispaul
  • 2
LVL 10

Expert Comment

ID: 40218801
Try The nextSibling property, which returns the node immediately following a given node!
LVL 13

Accepted Solution

duncanb7 earned 500 total points
ID: 40219010
Do want to click to all its child nodes besides first child node ? If so, see the following code

  $("#top li:not(:first-child)").click(
  function() {"green"
  alert( "Clicking" );

<ul id='top'>
 <li>First item</li>
 <li>Second item</li>
 <li>Third item</li>

Open in new window


Author Comment

ID: 40219016
thats the one

great thanks
LVL 13

Expert Comment

ID: 40219024
Thanks for your points and all code for jquery

Have a nice day

$("#top li:not(:first-child)").click(
  function() {
  alert( $(this).text() );

Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now