How to select the containing li with jQuery -


 <li><span class="close">&times;</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

Popular posts from this blog

c++11 - Intel compiler and "cannot have an in-class initializer" when using constexpr -

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -