05.02.2020, 07:33
Your script is not fully valid as it will change the class on any object value change. You are missing some if statements to check the object value.
$('.cls1').addClass('cls2'); will add class named cls2 to all elements that have class cls1 assigned to them.
$('.cls1').addClass('cls2'); will add class named cls2 to all elements that have class cls1 assigned to them.