Home Answers Viewqa JavaScriptQuestions Select all childs except first using JQuery

 
 


samar
Select all childs except first using JQuery
1 Answer(s)      2 years and 5 months ago
Posted in : JavaScript Questions

Hello Sir

I Have following code :

<ul>
 <li>First item</li>
 <li>Second item</li>
 <li>Third item</li>
</ul>

And i need to add a class to 2nd & 3rd element or child as follows :

<ul>
 <li>First item</li>
 <li class="NewClass">Second item</li>
 <li class="NewClass">Third item</li>
</ul>

Please reply with code.

Thank you in advance.

View Answers

December 14, 2010 at 5:15 PM


Its very simple Just use the following code line :

$("li:not(:first-child)").addClass("NewClass");









Related Pages:
Select all childs except first using JQuery
Select all childs except first using JQuery  Hello Sir I Have following code : <ul> <li>First item</li> <li>Second... a class to 2nd & 3rd element or child as follows : <ul> <li>First
JQuery
(':not(:first)').show() would show all the parents of every input element except...JQuery  hi there, I am just beginner for jQuery and i want to know-what is jQuery ? How it is better than JavaScript ?   jQuery
JQuery
to select option using key-board (means using key-down...JQuery  how to create jquery auto-complete textbox ? in which data...://www.roseindia.net/tutorial/jquery/autoSuggestTextbox.html   thank you
JQuery
using url of the doctors, use jquery autocomplete...JQuery  my requirement is: as i have a list of doctors in my table in the DB. a textbox is there in the browser it should display all the doctors
jQuery - jQuery Tutorials and examples
created many examples of using jQuery. View the demo's here. Learn jQuery step by step using the following tutorials: Overview of jQuery..., getting, and setting content using jQuery Manipulating attributes
jQuery Tutorials, jQuery Tutorial
, installing and developing first jQuery application Using different features... have included all the topics of jQuery and also given many examples of jQuery... application using jQuery and JavaScript Don't wait start learning jQuery
jQuery Demos
change event with multiple select option Form validation using jQuery... with an element using 'bind' jQuery 'select' form... in different file Display current time using jQuery & JSP
Column select
or no. Then using the query select * from resumes where experience='yes', fetch all the data... years of experience does candidate have. Then using the query Select * from...Column select   How i fetch Experience wise resume?   
jQuery Features
capability to select DOM elements so that we can add functionality to them using methods of jQuery. It is using CSS 3.0 syntax which provide us freedom to select one or more elements. Using CSS , you can select element by id, class
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Sir, Lots of thnx to ur reply .I went through both the tutorials... autocomplete textbox using jquery in jsp from mysql database. Kindly send me
Using the QUnit to test jQuery application
Using the QUnit to test jQuery application       Using the QUnit to test jQuery application Using Qunit , testing of JQuery become very easy and efficient
jQuery image replacement by click or select
jQuery image replacement by click or select In this section, you will learn... or reloading complete page. This will be done using jQuery. You need only jQuery set up file. In the below example, we are using jQuery setup file 
Understanding jQuery statement chaining
statement in jQuery : This code will first set the color of all links...;); Chainable 'if' statement using jQuery 'iff' : 'iff... Understanding jQuery statement chaining   
Use of jQuery attribute filters
will learn how to use attribute filters of jQuery. Using jQuery attribute filters... : Using it , you can hide all the link in your html page as : $("a[href... Use of jQuery attribute filters   
jQuery to Select Multiple CheckBox
jQuery to Select Multiple CheckBox       In this first jQuery tutorial we will develop a simple... the Select Multiple CheckBox  program Step 1: Create php file to that prints
jQuery to Select Multiple CheckBox
jQuery to Select Multiple CheckBox       In this first jQuery tutorial we will develop a simple... the Select Multiple CheckBox  program Step 1: Create php file to that prints
jQuery Tutorial
events, and develop Ajax applications. Using jQuery we can also develop plug...jQuery Tutorial jQuery is a cross browser, java Script library created by ... more". It handles the client side scripting of HTML. jQuery simplifies 
validate select option jquery
validate select option jquery  How to Validate select option in JQuery
Downloading and installing jQuery UI
There are Three ways of downloading or adding  jQuery UI : First... the complete set of all jQuery UI 1.8 components and the Smoothness theme... Downloading and installing jQuery UI   
jquery highlight textbox using jQuery
Content highlighting using jQuery In this section , you will learn how to highlight input row or group of input row using jQuery. In the below given example...;Content highlighting in form using jQuery - Example</title> <style>
Selecting element using jQuery.
Selecting element using jQuery In this tutorial , we will discuss about the different methods to select elements of html page. The jQuery has two ways to select elements. The first uses a combination of CSS and XPath selectors passed
jQuery filters
etc. Use of jQuery attribute filters Using jQuery attribute filters make... are using "a href " attribute of html DOM : Using it , you can hide all... jQuery filters      
jQuery required validation
jQuery required Validation: jQuery "required" is the method.../checkbox) or nothing selected (select). Works with text inputs, selects, checkboxes and radio buttons. To force a user to select an option from a select box
jQuery CSS Selector
jQuery CSS Selector       jQuery CSS Selector In this section we are learning about the jQuery CSS Selector. The CSS Selectors is the powerful API provided
jquery
jquery  how to display the leaves taken or holidays of the year or half working days in a calendar in some colors to identify the days using jquery plugin
Downloading and Installing jQuery
are using jQuery for adding Ajax capabilities into their web applications... will show you how you can develop your first Ajax jQuery application that shows... Downloading and Installing jQuery     
JQuery
JQuery  my requirement is: as i have a list of doctors in my table in the DB. a textbox is there in the browser it should display all the doctors..., use jquery autocomplete
Insert text into database table using JSP & jQuery
Insert text into database table using JSP & jQuery In this tutorial , the text is inserted into database table using JSP & jQuery. In the below example, the first JSP page is use to display text box in which we type data
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
Mysql PHP Select
; Mysql PHP is used to execute the select statement using mysql_query... php select: To view the table data using php,  you need to connect... table 'mytable' using select query. Now we make use of mysql_fetch_array
load more with jquery
load more with jquery  i am using jquery to loadmore "posts" from my site as pagination like twitter... it's working for all posts in my table..._reporting(0); $stt=mysql_query("select * from post order by post_date desc
jQuery UI Widget : Accordion
jQuery UI Widget : Accordion       jQuery UI Widget : Accordion Using...;#">First header</a></h3> <div>First content<
jQuery Training
developers and website designers. You can use jQuery with all the web development... and adding jQuery into your project Using jQuery for Ajax request a) jQuery... jQuery Training    
jQuery Utility Functions
of jQuery Utility Functions: .clearQueue() This function is used to remove all... jQuery Utility Functions      In this section we are discussing about jQuery Utility Functions
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button. Please give code also.   For all submit buttons, via JQuery, it'd
JQuery
JQuery  How to create time countdown ? which will start on click start button and pause on click pause button . also compatible to all browser
jQuery UI Widget : Tabs
jQuery UI Widget : Tabs       jQuery UI Widget : Tabs Tabs are generally...;jQuery UI Tabs</title> <link type="text/css" href
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...;/form> </body> </html> Please provide me JQuery code regarding
Theming JQuery
Theming JQuery       Theming JQuery The jQuery widgets are designed... ,that is, standard jQuery UI CSS Framework styles and plugin-specific
jQuery UI Tabs
jQuery UI Tabs In this section, you will learn about UI tabs .For using UI tabs you need add "jquery-ui-1.8.4.custom.min.js" plug-in in your html page. For using you have to create unordered list inside div. The complete
jQuery Multiple Checkbox Select / Deselect
"); } }); }); jQuery Multiple Checkbox Select / Deselect In this section, you will learn... $(function(){ // add multiple select / deselect functionality...); }); // if all checkbox are selected, check the selectall checkbox
First Step towards JDBC!
and simple.    JDBC Versions From First To Latest  ...; Understanding Common SQL Statements  This section describes SELECT, INSERT... all java types.    Deleting a Table from Database
how to operate on select box using ajax in struts2?
how to operate on select box using ajax in struts2?  I am doing a project on struts2 in which i have a jsp page which has two select boxes like... it will retrieve me all the blocks under it by assigning to the block list select
how to operate on select box using ajax in struts2?
how to operate on select box using ajax in struts2?  I am doing a project on struts2 in which i have a jsp page which has two select boxes like <... so that when i select a district value it will retrieve me all the blocks under
JQuery-Selecting class or ID
JQuery-Selecting class or ID  Hi Guys, I am new to JQuery. I am getting little trouble in selecting an item using class or ID in jQuery..." : $('#element1') Since IDs are unique, so it will select only the element of particular id
A LSI chip contains the entire CPU of computer except main memory is called
A LSI chip contains the entire CPU of computer except main memory is called  A LSI chip contains the entire CPU of computer except main memory is called? 1. Microprocessor 2. Hard Disk 3. Input Device 4. Output Device 5. All
jQuery Example, jQuery to Retrieve Server's Current Time, jQuery Server time
jQuery to Count the Select Options       In this first jQuery tutorial we will develop a  program that count the select option Steps to develop the program  
Proplem with select data - Struts
Proplem with select data  Hi , Please can u give me a example for display all data from the database (Access or MySql) using Struts
SQL UNION ALL Operator
two different tables. The UNION ALL combine two table using select... is used to combine two table using select statement when both the ... the same data types.The UNION ALL select all the records from both table

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.