javascript - Checking for a css class on the nearest sibling() div with jQuery? -
is there way in jquery return nearest sibling() div , check present class?
i have visual verticle list of items, in items either have 1px border (to set them apart - premium items) or no border @ (standard items). while looks great when premium item sandwiched between 2 standard items, when 2 or 3 premium items stack borders between them end being 2px thick.
i'm looking way, using jquery or otherwise, check if <div class="item">
above current div has class featured-item (so checking if div equals <div class="item featured-item">
). there, set class name set border-top 0px , make visuals flow little better.
can me out? sorry if question convoluted, hard explain!
if ($("#current-div").prev().hasclass("someclass")) { // logic here }
Comments
Post a Comment