Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

last sibling in jquery?

Tags:

jquery

could someone help me to select last sibling of clicked element in jquery?

like image 525
ajsie Avatar asked Jan 24 '10 08:01

ajsie


People also ask

How can I find previous siblings in jQuery?

jQuery prev() Method The prev() method returns the previous sibling element of the selected element. Sibling elements are elements that share the same parent. The DOM tree: This method traverse backwards along the previous sibling of DOM elements.

What is last child jQuery?

Definition and Usage. The :last-child selector selects all elements that are the last child of their parent. Tip: Use the :first-child selector to select elements that are the first child of their parent.

What does siblings do in jQuery?

The siblings() is an inbuilt method in jQuery which is used to find all siblings elements of the selected element. The siblings are those having same parent element in DOM Tree.

Is jQuery the last element?

The last() function is an inbuilt function in jQuery which is used to find the last element of the specified elements. Here selector is the selected elements. Parameters: It does not accept any parameter. Return value: It returns the last element out of the selected elements.


1 Answers

$("#myElement").click(function() {     $(this).siblings(":last").hide(); }); 
like image 123
karim79 Avatar answered Sep 22 '22 10:09

karim79