Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions Select all childs except first using JQuery
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


samar
Select all childs except first using JQuery
1 Answer(s)      4 years 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.


Advertisement
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 Tutorials/Questions & Answers:
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
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
Advertisements
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
validate select option jquery
validate select option jquery  How to Validate select option in JQuery
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
(':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
select query using hibernate
select query using hibernate  Hi, can any one tell me to select records from table using hibernate. Thanks   Please visit the following link: Hibernate Tutorials The above link will provide you different
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   
JDBC Select All Records Example
JDBC Select All Records Example In this tutorial we will learn how select all...; for select  all records from table if exist and defined how the records fetch and store. This example applied mysql query "SELECT * FROM user"
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
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
Vertical news slider using jquery
Vertical news slider using jquery  how to creatw vertical news slider using jquery Sorry for wrong category but i cant get my jquery category
Show Limited Data Using jquery
Show Limited Data Using jquery  How to show limited results in JQuery... it using JQuery?   See the JQuery example to show the limited fetch results in JQuery. var comments = $('.description_text').size(); if (comments >
jQuery change event with multiple select option
jQuery change event with multiple select option In this tutorial , we will discuss about 'change' event of jQuery with multiple select list & it also display the selected option. In the below example a multiple select list
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 'select' form event
jQuery 'select' form event In this tutorial, we will discuss about 'select ' form event to display message when we select something inside input box. In this Example, two input text box are given , when we select
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
Using the jQuery Transform plug-in(XSLT)
Using the jQuery Transform plug-in(XSLT)       Using the jQuery Transform plug-in(XSLT... Language Transformations ). The jQuery Plugin we are using
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
application using AJAX and JQuery and also use JSP
application using AJAX and JQuery and also use JSP   i need create an application using AJAX and JQuery and also use JSP
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
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 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 
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery... to these standards, this system normalize the event object. jQuery. Event
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 - 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
Find Browser & it's version using jQuery
Find Browser & it's version using jQuery  Hi sir I heard that JQuery have some method which can be used to find the Browser name & its version. I need the code which checks the browser and if it is "Mozilla", it will show
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>
Advertisements
 

 

 

DMCA.com