Last active
May 6, 2016 18:50
-
-
Save gustavom/9771a6fad7a100fc781235e898082a40 to your computer and use it in GitHub Desktop.
Closest jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$("span").closest("ul").css({"color": "red", "border": "2px solid red"}); | |
}); | |
/* | |
diferente do parent(), ele varre os elementos 'pai' até encontrar o definido; | |
No exemplo, a partir do elemento 'span', o js vai varrer os elementos pai, até achar uma 'ul'. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment