add and remove class in jquery

JavaScript
$('#toggle li').on('click', function () {
    $(this).toggleClass('open')
});
Source

Also in JavaScript: