Tuesday, 15 April 2014

jquery - Target the child element of a .last() -



jquery - Target the child element of a .last() -

how 1 target specific kid element of .last() element.

here's have currently:

html

<div class="rules-step"><select class="and_option"></select></div> <div class="rules-step"><select class="and_option"></select></div> <div class="rules-step"><select class="and_option"></select></div> <div class="rules-step"><select class="and_option" style="opacity:0.5"></select></div> <a class="deletelistitem"></a>

js

$(".deletelistitem").on('click', function() { $(".rules-step").last().siblings('.and_option').css( "opacity", "1" ); });

thanks in advance.

use .find() instead of .siblings() select kid elements of div:

$(".deletelistitem").on('click', function() { $(this).siblings(".rules-step").last().find('.and_option').css( "opacity", "1" ); });

jquery

No comments:

Post a Comment