There is a group of switches that turn dark gray when choosing a switch :check .
Everything works well as long as the submission form on the page is filled out correctly, but as soon as it makes a mistake and the page reloads with error notification, the group of switches ceases to turn dark gray when the switch is selected.
How can this be fixed?
Code:
jQuery.noConflict(); jQuery(document).ready(function($) { let className = 'label-active'; let $inputs_time = $('#order_time_field input[type=radio]'); $inputs_time.change(function(ev) { $inputs_time.parent('label').removeClass(className); $(this).parent('label').addClass(className); }); }); .form-row label.label-active { background-color: #e4e4e4; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div data-priority="20" class="form-row form-row-wide" id="order_time_field"> <fieldset> <legend>ΠΡΠ΅ΠΌΡ Π΄ΠΎΡΡΠ°Π²ΠΊΠΈ</legend><label><input type="radio" name="order_time" value="ΠΠ»ΠΈΠΆΠ°ΠΉΡΠ΅Π΅"> ΠΠ»ΠΈΠΆΠ°ΠΉΡΠ΅Π΅</label><label><input type="radio" name="order_time" value="Π ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½Π½ΠΎΠΌΡ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ"> Π ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½Π½ΠΎΠΌΡ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ</label></fieldset> </div>
jQuery(document).ready(function($)is overridden somewhere , Maxim Stepanov