2016-03-25 4 views
0

Ich benutze select2 mit Platzhalter, das Problem ist, wenn ich nur eine Option in der Select-Steuerelement habe, kann ich es nicht auswählen. Wenn ich auf die Option klicke, wird immer der Platzhalter angezeigt. Es scheint, als wäre die erste Option bereits ausgewählt.Select2 nicht auswählen, wenn nur eine Option

This is how I see the option

<div class="form-group "> 
 
    <label class="control-label requiredField" for="contatoCondominio"> 
 
     Requisitante <span class="asteriskField">*</span> <i class="fa fa-circle-o-notch fa-spin" style="visibility: hidden;" id="contato-loading"></i> 
 
    </label> 
 
    <select class="select form-control select2-hidden-accessible" id="contatoCondominio" name="contatoCondominio" tabindex="-1" aria-hidden="true"> 
 
    \t <option value="14">Nome do Sindico</option> 
 
\t </select> 
 
\t <span class="select2 select2-container select2-container--bootstrap select2-container--below" dir="ltr" style="width: 988px;"> 
 
\t \t <span class="selection"> 
 
\t \t \t <span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-contatoCondominio-container"> 
 
\t \t \t \t <span class="select2-selection__rendered" id="select2-contatoCondominio-container"> 
 
\t \t \t \t \t <span class="select2-selection__placeholder">Selecione um opção</span> 
 
\t \t \t \t </span> 
 
\t \t \t \t <span class="select2-selection__arrow" role="presentation"> 
 
\t \t \t \t \t <b role="presentation"></b> 
 
\t \t \t \t </span> 
 
\t \t \t </span> 
 
\t \t </span> 
 
\t \t <span class="dropdown-wrapper" aria-hidden="true"></span> 
 
\t </span> 
 
</div>

Dank

Antwort

0

Sie verpassen die leere Option erforderlich, wenn Sie einen Platzhalter verwenden. Das einzelne Ergebnis kann nicht ausgewählt werden, da es automatisch vom Browser ausgewählt wurde und Select2 nicht weiß, was zu tun ist.

+0

Danke @kevinBrown! – Rodoxx