codeGK
Code it ALL
jQuery parentsUntil() - CodeGK

♦ jQuery parentsUntil()

♣ Example3: jQuery parentsUntil()

Below is the representation of jQuery parentsUntil() Syntax.
Basic Syntax
$(selector).parentsUntil(limitTag).event(function(){
//code_block
});
Syntax Explanation:
selector : the element of which parents are to be selected
limitTag : tag upto which parents are supposed to be selected
event : this can be events(click, hover, etc) or css or addClass, etc
code_block : code to executed on all the parent tags
In this example, all the parent borders of level 4 are blue-colored until level 2.
Example
Input:
Output: