How to select the containing li with jQuery -
<li><span class="close">×</span> <%= item %></li>
when user clicks close icon, want hide <li>
. how can that?
not sure how "select" span, lets assume click.
$('.close').on('click', function() { $(this).closest('li').hide(); });
you'd closest li element closest();
Comments
Post a Comment