prevAll([selector]) trong jQuery



Miêu tả

Phương thức prevAll([selector]) trong jQuery tìm tất cả phần tử anh em ở trước phần tử hiện tại.

Cú pháp

Sau đây là cú pháp để sử dụng prevAll([selector]) trong jQuery:

selector.prevAll( [selector] )

Tham số

Chi tiết tham số được sử dụng trong phương thức prevAll([selector]) trong jQuery:

  • selector − Selector tùy ý này để lọc các phần tử ở trước.

Ví dụ

Ví dụ đơn giản sau minh họa cách sử dụng của prevAll([selector]) trong jQuery.


   
      The jQuery Example
      
		
      
		
      

   
	
   
      
first
sibling
child
sibling
sibling

Nó sẽ cho kết quả:


   
      The jQuery Example
      
		
      
		
      

   
	
   
      
first
sibling
child
sibling
sibling

Nó sẽ cho kết quả:

Các bài học jQuery khác tại VietJack:


truy_cap_dom_trong_jquery.jsp