Child filter basically handles filtration according to parent-child relationship.
Some main Child filters are given below :
It filters all the elements which are first child of their parent.
Example :
$("div span: first-child").css("text-decoration",
"underline")
It filters the first span of each matched div.
It filters all the elements which are last child of their parent.
Example :
$("div span: last-child").css({color:"red",
fontSize:"80%"})
It filters the last span of each matched div.
It filters all the elements which are nth child of their parent.
Example : (nthChildSelector.html)
<!DOCTYPE html> |

Finds the second li in each matched ul and notes it.
It filters all the elements which are only child of their parent.
Example : (onlyChildSelector.html)
<!DOCTYPE html> |
Output :

Description of the program
It filters the button with no siblings in each matched div and modify it's look by creating border around it and rename it's name.
Learn from experts! Attend jQuery Training classes.
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.
Ask Questions? Discuss: Child Filter
Post your Comment