Jquery removeClass not work on my wordpress theme

Solution:

It may have something to do with the fact that the second click listener is sitting on top of the first (the element is in ‘body’ which has a click listener on it) – which is causing the click on the remove button to also trigger the click on the body. Try adding e.stopPropagation() as per this example.

 

$('body').on('click', function() {
console.log('body clicked');
})

$('.b0').on('click', function() {
console.log('button 0 clicked');
})

$('.b1').on('click', function(e) {
e.stopPropagation()
console.log('button 1 clicked');
})
body{
height:100%;
background:#f0f0f0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
<button class='b0'>click first</button>
<button class='b1'>click second</button>
</body>