The jQuery index :gt selector is used
to get all the child elements under a parent which have an index value greater
that the specified value.
:gt(0)
In this post we shall see on how to use the jQuery index :gt selector to get the list of elements which have an index value greater that the specified value.
The following script gets the child elements of the parent tr element trName which have an index greater than 0.
alert('Hierarchy Parent:' + $("#trName").attr('id'));
$("#trName
td:gt(0)").each(function() {
alert('Hierarchy
- td with Index > 0:' + $(this).attr('id'));
});
The following script gets the child elements of the parent tr element trName which have an index greater than 0 on click of the btnHierarchySelector button.
$('#btnHierarchySelector).click(function(event) {
event.preventDefault();
//
// Hierarchy - Index
The following script gets the child elements of the parent tr element trName which have an index greater than 0 on click of the btnHierarchySelector button.
$('#btnHierarchySelector).click(function(event) {
event.preventDefault();
//
// Hierarchy - Index
alert('Hierarchy
Parent:' + $("#trName").attr('id'));
$("#trName
td:gt(0)").each(function() {
alert('Hierarchy
- td with Index > 0:' + $(this).attr('id'));
});
});
});
Related Post
jQuery hierarchy selector
jQuery first selector
jQuery last selector
jQuery even selector
jQuery odd selector
jQuery only-child selector
jQuery parent selector
jQuery nth-child selector
jQuery index :gt selector
jQuery empty selector
jQuery first selector for Textbox
jQuery last selector for Textbox
jQuery first selector for Dropdown
jQuery last selector for Dropdown
jQuery hierarchy selector Example
jQuery hierarchy selector
jQuery first selector
jQuery last selector
jQuery even selector
jQuery odd selector
jQuery only-child selector
jQuery parent selector
jQuery nth-child selector
jQuery index :gt selector
jQuery empty selector
jQuery first selector for Textbox
jQuery last selector for Textbox
jQuery first selector for Dropdown
jQuery last selector for Dropdown
jQuery hierarchy selector Example
No comments:
Post a Comment