Are you first timer at Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - click event to add and remove active class

0 votes
added Apr 17 in jQuery by LC Marshal Captain (23,680 points)
$('.floating-menu').click(function () {
    $(this).addClass('active');  // use this to add class instead



.floating-menu {
  text-align: center;
  padding: 12px;
  border-bottom: 1px dotted #000;
  font-size: 1.2rem;
  &:hover, &.active {
    background: $award19-color;


Please log in or register to response this reference. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.