Greetings Dear! There is such a tricky functional:
The code for this functionality is:
<section class="col col-6"> <label class="toggle"> <input name="monetizationType" value="rebill" type="radio"> <i data-swchon-text="ВКЛ" data-swchoff-text="ВЫКЛ"></i><h5 id="rebill" class="text-left text-success"><strong>Ребиллы</strong></h5></label> <label class="toggle"> <input name="monetizationType" value="autosell" type="radio"> <i data-swchon-text="ВКЛ" data-swchoff-text="ВЫКЛ"></i><h5 id="autosell" class="text-left text-danger"><strong>Автовыкуп</strong></h5></label> <label class="toggle"> <input name="monetizationType" value="credit" type="radio"> <i data-swchon-text="ВКЛ" data-swchoff-text="ВЫКЛ"></i><h5 id="credit" class="text-left text-danger"><strong>Кредитование</strong></h5></label> </section> The processing code for this data is:
$("#smart-mod-eg1").click(function(e) { $.SmartMessageBox({ title : "Изменение настроек", content : "Вы действительно хотите изменить настройки аккаунта?", buttons : '[НЕТ][ДА]' }, function(ButtonPressed) { if (ButtonPressed === "ДА") { var msg = $('#settingsUpd').serialize(); $.ajax({ type: 'POST', url: '<?php echo ASSETS_URL; ?>/php/settings.php', data: msg, success: function(data) { $('#error').html(data); }, error: function(xhr, str){ alert('Возникла ошибка: ' + xhr.responseCode + '. Разработчики уже в курсе...'); } }); $.smallBox({ title : "Выполнено", content : "<i class='fa fa-cog'></i> <i>Настройки изменены</i>", color : "#659265", iconSmall : "fa fa-check fa-2x fadeInRight animated", timeout : 5000 }); $('#rebill').removeClass('text-left text-danger'); $('#rebill').addClass('text-left text-success'); } if (ButtonPressed === "НЕТ") { $.smallBox({ title : "Не выполнено", content : "<i class='fa fa-cog'></i> <i>Вы отказались от изменения настроек</i>", color : "#C46A69", iconSmall : "fa fa-times fa-2x fadeInRight animated", timeout : 5000 }); } }); e.preventDefault(); }) so, in this piece of handler code:
$('#rebill').removeClass('text-left text-danger'); $('#rebill').addClass('text-left text-success'); removes the class that highlights it in red and adds the class that highlights the text in green. But in this embodiment, he does it only with id = rebill. How to generate code correctly so that it is with the condition - if id = rebill is in ON mode, i.e. then we do this, if id = autosell, then we do this, and so on? Those. my settings are changed without a reboot, and it is necessary that without a reboot there is a corresponding selection of text in color.
Thank you for attention!
