R
R
Roman-Belgorod2015-09-22 21:20:48
css
Roman-Belgorod, 2015-09-22 21:20:48

How to create a title in the first field from a select and option dropdown list?

Hello. There is a select dropdown list and an option in the first field that needs to be named "Bank Selection". Through option selected it turns out, but an additional unnecessary field pops up that activates unnecessary content. Example:
HJfTslNl.png
HTML

<select class="select-dropdown">
<option selected>Выбор банка</option>
 <option value="1">Тинькофф банк</option>
 <option value="2">Соверен банк</option>
 <option value="3">Ситибанк</option>
  <option value="4">Банк Москвы</option>

</select>

JAVASCRIPT
$(document).ready(function(){

    $("div[class^=contents]:not(:first)").hide()

    $('.select-dropdown').change(function() {
        value = $(this).find('option:selected').val();
   
        $('div[class^="contents"]').hide();
        $('.contents'+value).show();
    });
});

Example:
jsfiddle.net/u14yp9y4/3

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrew, 2015-09-22
@Menlod

jsfiddle.net/u14yp9y4/4 if it's quite simple

D
Dmitry Kim, 2015-09-22
@kimono

<select class="select-dropdown">
<option>Выбор банка</option>
 <option value="1">Тинькофф банк</option>
 <option value="2">Соверен банк</option>
 <option value="3">Ситибанк</option>
 <option value="4">Банк Москвы</option>
</select>

Not?

S
sergey, 2015-09-22
@zorro76

Here's an example for you

R
Roman-Belgorod, 2015-09-22
@Roman-Belgorod

The issue has been resolved, but not completely. It is enough to add:
It remains only to hide this field in the drop-down list, which is repeated ("Select Bank")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question