Selector | Description |
---|---|
eq(index) | The set of matched elements to a single element is reduced. |
filter(selector) | All the elements from the set of matched elements that do not match the specified selector are removed. |
filter (function) | All the elements from the set of matched elements that do not match the specified function are removed. |
is(selector) | The current selection is checked against an expression and returns true, if atleast one element of the selection fits the given selector. |
map (callback) | A set of elements in the jQuery object into another set of values in a jQuery array is converted. |
not(selector) | The elements matching the specified selector from the set of matched elements are removed. |
slice(start, end) | A subset of the matched elements are selected. |
Selector | Description |
---|---|
add(selector) | Adds more elements matched by the given selector to the set of matched elements. |
andSelf() | The previous selection is added to the current selection. |
children([selector]) | A set of elements is found which contains all the unique immediate children of each of the matched set of elements. |
closest(selector) | A set of elements is found which contains the closest parent element that matches the specified selector including the starting element. |
end() | The most recent 'destructive' operation is reverted changing the set of the matched elements to its previous state. |
contents() | All the child nodes inside the matched elements can be found. |
find(selector) | Searches the elements matching the specified selectors. |
next(selector) | Finds a set of elements that contains the unique next siblings of each of the given set of elements. |
nextAll(selector) | Finds the sibling elements after the current element. |
offsetParent() | Returns a jQuery collection with the positioned parent of the first matched element. |
parent(selector) | Gets the direct parent of an element. If it calls a set of elements the parent returns a set of their unique direct parent elements. |
parents(selector) | Finds a set of elements containing the unique ancestors of the matched set of elements (except for the root element). |
prev(selector) | A set of elements is found that contains the unique previous siblings of each of the matched set of the elements. |
prevAll(selector) | It finds all the sibling elements in front of the current element. |
siblings(selector) | It finds a set of elements that contain all the unique siblings of the matched set of elements. |
<html>
<head>
<title> eq method </title>
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">
</script>
<script type="text/javascript" language ="javascript">
$(document).ready(function()
{
$("li").eq(3).addClass("selected");
});
</script>
<style>
.selected {color:red;} //adds color to located list item
</style>
</head>
<body>
<div>
<ul>
<li> MBA </li>
<li> MCA </li>
<li> BE </li>
<li> Law </li>
<li> CA </li>
</ul>
</div>
</body>
</html>
<html>
<head>
<title> filter method </title>
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">
</script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function()
{
$("li").filter(".c2").addClass("selected");
});
</script>
<style>
.selected {color:blue;} //adds color to the lists associated with the middle class
</style>
</head>
<body>
<div>
<ul>
<li class="c1"> MBA </li>
<li class="c1"> MCA </li>
<li class="c2"> BE </li>
<li class="c3"> Law </li>
<li class="c2"> CA </li>
</ul>
</div>
</body>
</html>
<html>
<head>
<title> refining selections</title>
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">
</script>
<script type="text/javascript" language ="javascript">
$(document).ready(function()
{
$("p").find("span").addClass("selected");
});
</script>
<style>
.selected {color:red;} //adds color to the lists associated with the middle class
</style>
</head>
<body>
<p> 1st para:<span>TutorialRide</span></p>
<p> 2nd para:<span>E-Learning</span></p>
</body>
</html>