Return to Snippet

Revision: 28455
at July 8, 2010 17:29 by omerta83

Initial Code
//Let's set the background color of the nearest  
//UL in this pseudo-menu  
$('li.subchild').closest('ul').css('background-color', 'red');  

// Example

<li>Parent Menu  
<li class="subchild">Child Item 1</li>  
<li class="subchild">Child Item 2</li>  

Initial URL

Initial Description

Initial Title
How to find closest element to another

Initial Tags
javascript, jquery

Initial Language