I am trying to add a class to a `<li>` element on a click event and then remove that class on the subsequent click of another element in the same `<ul>`. No problem adding the class but I've tried a number of approaches, unsuccessfully to remove the class.

```
<ul>
  <li  class="show" id="all">All Posts</li>
  <li  class="show" id="user" data-user="7">My Posts</li>
  <li  class="show" id="follow">Following</li>
</ul>

$(document).ready(function() {

$("li").click(function(event) {

    var name = event.target.className;
var newclass = 'choice';
  //console.log(name);

if($(event.target)) {
  $(event.target).addClass(newclass);
  }

if(!$(event.target)) {
  $('li').each(function() {
        $('.' + name + '.' + newclass).removeClass(newclass);
    })
}

$('.'+ name + "." + newclass).attr('style','background-color:yellow');

//console.log(name);

    });
});

```