I have one item (#engaged) to which I have to add a class on jQuery click. There are 20 variants on which if users clicks a different class will be added to #engaged.
For example, if the user clicks #one, class .one should be added to #engaged. Similarly, if the user clicks #two, class .two should be added to #engaged.
I know how to do it, but the problem is that it only works one or two times on page load. More clicks are not accepted, even if I remove the previous added class on next click. How can I make it accept more clicks without reloading the page?
$("#one").click(function () {
    $("#engaged").mouseenter(function () {
        $(this).addClass("one");
    });
    $("#engaged").mouseleave(function () {
        $(this).removeClass("one");
    });
});
$("#two").click(function () {
    $("#engaged").mouseenter(function () {
        $(this).addClass("two");
    });
    $("#engaged").mouseleave(function () {
        $(this).removeClass("two");
    });
});
..... and so on
 
     
     
     
    