jQuery/Check if image is wrapped in a list item

Goorbla

New Member
I'm using javascript and jQuery to make a light box, and I have a simple function that wraps each image, inside a container div, with a list item, but I want to check to see if they're already wrapped in list items or not. Does anyone know of a way to do it?Something like this:\[code\]$('img, div.LBcontainer').each( function() { //other stuff if ( $(this).parent() = li) { // Not sure of the syntax for it $img.unwrap(); } else { $img.wrap('<li id="images_LB"></li>'); }});\[/code\]
 
Top