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



Home Answers Viewqa JavaScriptQuestions Select all childs except first using JQuery

Have Programming Question? Ask it here!
 
 
 


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


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 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 
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
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
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 - 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 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>
Crop image Using JQuery, servlet or JSP.
Crop image Using JQuery, servlet or JSP.  Hi sir I need the code of Cropping image using JQuery with the help of servlet or JSP. I need both the code Client side as well as of server side. Please Help me
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
check username availability using JSP & JQuery
check username availability using JSP & JQuery  Hi sir I want check username availability using JSP & JQuery. Please add code with your answer. Thnks in advance
SELECT query using executeUpdate() instread of executeQuery()
SELECT query using executeUpdate() instread of executeQuery()  can we execute SQL SELECT query using executeUpdate() instread of executeQuery() method   Hi Friend, No, You cannot. Thanks
Test hidden element using JQuery
Test hidden element using JQuery  Suppose i have an element which i am hiding and showing, using .hide(), .show() or .toggle().How do you test to see... using following code snippet : $(element).is(":visible") Hope this will helpful
Implementing Digits restriction Using JQuery
Implementing Digits restriction Using JQuery  Hi Sir I have following field in my html form : <div>Age<input type="text" name="quantity.... Please provide code.   You can implement these two things using ASCII code
Replace broken Image using JQuery
Replace broken Image using JQuery  Sir My web page contains a lot of images. But when it will not loaded properly, it shows a broken image. How can I fix it so that broken image will be replaced by error image automatically
Select Records Using Prepared Statement
Select Records Using Prepared Statement   ... to select some specific records by using the PreparedStatement. We know... SelectRecords Select Records Example by using the Prepared Statement
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
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
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
Auto grow Text Area using jQuery plug-in
Auto grow Text Area using jQuery plug-in  Hi sir How can we make a textarea auto grow ? What is the name of the plug-in used for auto grow text area. Please mention code with your reply
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
SELECT query using executeUpdate() instread of executeQuery()
SELECT query using executeUpdate() instread of executeQuery()  for Ex...{ st.executeUpdate("select * from EMP"); //gives us Exception... executeUpdate() method with select quesry then you can't be able to retrieve data from
how to validate the telephone number without using jquery in html with javascript
how to validate the telephone number without using jquery in html with javascript  how to validate the telephone number without using jquery in html with javascript
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
JQuery
JQuery  how to use 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
Getting the ID of the element that fired an event using JQuery
Getting the ID of the element that fired an event using JQuery  Hello sir I want to know-Is there any way to get the ID of the element that fires... to understand the concept. Thanks in advance   Dear friend In jQuery
Advertisements
 

 

 

DMCA.com