2016-05-04 18 views
0

Bitte helft mir :(Ich weiß, dass das Attribut selectauswählen und die erforderliche Optionsfeld Attribut

<select required></select> 

sein sollte Aber ich habe eine CSS wie werde ich es

<div class="col-md-6"> 
          <div class="form-group"> 
           <label for="sel1">Which division of our company are you interested in *</label> 
           <select class="form-control" id="sel1"> 
           <option>Please select one</option> 
           <option>Video game consoles and accessories</option> 
           <option>Gaming and entertainment gift cards/codes</option> 
           <option>Both</option> 
           </select> 
          </div> 
          </div> 

AUCH setzen? Wie kann ich die Radio-Buttons machen auch erforderlich? Für die anderen-bitte-Option angeben.

<div class="col-md-6"> 

           <label for="form_business">Type of business *</label> 
           <div>          
            <label class="radio-inline" style="padding-left:30px;"> 
            <input type="radio" name="optradio">Retailer 
            </label> 

            <label class="radio-inline"> 
            <input type="radio" name="optradio">Other - Please specify 
            </label> 
            <input id="form_other" type="text" name="other" class="form-control" placeholder="Please specify"> 
            </div> 
           </div> 
+0

Verwenden 'jquery-validation' .. –

Antwort

1

Radiobutton: siehe here. Sie müssen nur das required Attribut für einen Eingang der Radiogruppe setzen, aber Sie können es für alle einstellen.

<div> 
    <label class="radio-inline" style="padding-left:30px;"> 
    <input type="radio" name="optradio" required>Retailer 
    </label> 

    <label class="radio-inline"> 
    <input type="radio" name="optradio">Other - Please specify 
    </label> 
    <input id="form_other" type="text" name="other" class="form-control" placeholder="Please specify"> 
</div> 

Für ausgewählte: Pflicht haben den ersten Wert leer - erforderlichen Arbeiten auf leere Werte. see more

<select class="form-control" id="sel1" required> 
    <option value="">Please select one</option> 
    <option>Video game consoles and accessories</option> 
    <option>Gaming and entertainment gift cards/codes</option> 
    <option>Both</option> 
</select> 

Geige here

+0

Dank dafür! Ich habe es herausgefunden, aber wie wäre es mit einer ausgewählten Form? Ich habe versucht, nach der Klasse erforderlich, aber es hat nicht funktioniert – Nnn

+0

@Nnn ich habe die Antwort aktualisiert –

Verwandte Themen