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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
$q.all is slower or not  in  Angularjs 2 21
Wordpress Pagination 1 28
Ahax pagination 9 32
Html input text color the frame line 2 20
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

791 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