$('#element').click(() => {
$(this).removeClass('class-to-temove').addClass('class-to-add');
});
$('#element').click(() => {
$(this).toggleClass('class-to-add class-to-remove');
});
<? echo $form->field($model1, 'operation')->hiddenInput(['value' => 'hidden value']); ?>