V
V
Valery Madyarov2021-06-16 11:56:44
JavaScript
Valery Madyarov, 2021-06-16 11:56:44

How to make select checkbox hidden until input is clicked?

Hello dear!

There is a form code - in short

<div class="input">
                            <input type="text" name="name" required>
                            <span>Ваше имя</span>
                        </div>
                        <!--  -->
                        <div class="input">
                            <input type="text" name="phone" required>
                            <span>Номер телефона</span>
                        </div>

                        <div class="input">
                            <input type="text" name="phone" required>
                            <span>Ваш город</span>
                            <select name="form_select">
                                <option value="Nur-sultan" selected="selected">Нур-Султан</option>
                                <option value="Karaganda" >Караганда</option>
                            </select>


And there are also styles that make Input clickable.
60c9bc94efb69434626180.png

Is it possible to make it so that when you click on the Input of the city, you can make it so that it becomes visible and one turn before pressing ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Edward, 2021-06-16
@MJ98

Since the Bitrix tag, we do on it:

<select id="city" name="form_select" class="hidden" >
  <option value="Nur-sultan" selected="selected">Нур-Султан</option>
  <option value="Karaganda">Караганда</option>
</select>

.hidden {
  display: none;
}

BX.ready(function() {
  BX.bind(BX('city'),  'click',  () => {
    BX.removeClass(BX('city'), 'hidden');
  });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question