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

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

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -