2016-05-04 4 views
0

Пожалуйста, помогите мне :(Я знаю, что выбрать атрибут должен бытьВыбор и радио кнопки необходимый атрибут

<select required></select> 

Но у меня есть CSS, как я буду ставить?

<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> 

ТАКЖЕ, как я могу сделать обязательно, а также кнопки радио? Для других-просьба указать опцию.

<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

Используйте 'JQuery-validation' .. –

ответ

1

Радиокнопка: см. here. Вам просто нужно установить атрибут required для одного входа радиосвязи , но вы можете установить его для всех.

<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> 

Для выбора: Обязательно Наличие первого значения пустые - обязательные работы на пустые значения. 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> 

скрипку here

+0

Спасибо за это! Я действительно понял это, но как насчет выбранной формы? Я попробовал поставить после класса, но он не работает – Nnn

+0

@Nnn У меня есть обновленный ответ –

Смежные вопросы