Created
September 14, 2017 06:32
-
-
Save catindev/8f48a7340fdb05e4c0309cb36b24795d to your computer and use it in GitHub Desktop.
Проверяем выбран ли тип пользователя
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- 1. Добавляем id контейнеру с радиокнопками для выбора пользователя --> | |
| <div class="form-group" id="reg_type"> | |
| ... | |
| </div> | |
| <!-- 2. Под этот контейнер ставим сообщение об ошибке --> | |
| <div class="alert alert-danger" style="display:none" id="regTypeAlert"> | |
| <strong>Не выбран тип пользователя</strong><br/> | |
| Без него вы не сможете заполнить данные для участия в мероприятиях. | |
| </div> | |
| <!-- 3. Джаваскрипт для этого всего --> | |
| <script> | |
| $('#submit_reg').on('click', function (event) { | |
| if ($('input[name=reg_type]:checked').length === 0) { | |
| event.preventDefault(); | |
| $('#regTypeAlert').slideDown(); | |
| } | |
| }); | |
| $('#reg_type label').on('click', function (event) { | |
| $('#regTypeAlert').hide(); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment