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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at Browse or search based on font properties or name to find a suitable font for…
The viewer will learn how to dynamically set the form action using jQuery.

631 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