The jQuery last selector
can
be used with other
type selectors to filter elements specific to the types, here is the syntax to
use the last selector with the text type selector.
input[type=text]:last
In this post we shall see on how to use the jQuery last selector with the text type selector to get the last textbox element in the page.
The following script gets the last textbox element in the page.
// Hierarchy - Empty (No Children)
// Hierarchy -
First TextBox
alert('Hierarchy
- Last TextBox:' + $("input[type=text]:last").attr('id'));
The following script gets the last textbox element in the page on click of the btnHierarchySelector button.
$('#btnHierarchySelector).click(function(event) {
event.preventDefault();
//
// Hierarchy - Last TextBox
The following script gets the last textbox element in the page on click of the btnHierarchySelector button.
$('#btnHierarchySelector).click(function(event) {
event.preventDefault();
//
// Hierarchy - Last TextBox
alert('Hierarchy
- Last TextBox:' + $("input[type=text]:last").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