Remove a list-item!


#1

Hey there, everyone!

How can I remove a "prepended" list-item simply by clicking on it? Or, specifically, what should I TARGET in order to remove that very item?!.

Thank you.


#2

which lesson? post a link, please


#3

Of course, certainly! ^_^

https://www.codecademy.com/courses/web-beginner-en-hk5qh/0/1?content_from=make-an-interactive-website%3Ajquery-dom-manipulation


#5

Actually, I finished this entire lesson. Yet, it does not include any "removing" task. Thus, I wondered if someone can invent a method to delete or remove a ('.posts') listed-item only by clicking on it, or so I presumed! ^_^

I thank you kindly, Mr. @yuta0827 for your replaying effort. Yet, this isn't what I truly asked for.


#6

Under the .btn click handler, insert this code as its own handler.

  $('.posts').on('click', 'li', function() {
      $(this).remove();
  });

#7

Thank you so much... I loved this piece of code of yours, sir! ^_^


#8

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.