简体   繁体   中英

Stray start tag label.HTML validation

I tried to validate the code and receive the following error:

Stray start tag label.

In all 3 label.

CODE HTML:

<div class="col-md-3 target-col desc-marketing" >
   <label >Targeted Lists</label>
   <div class="select-style" id="targeted-list">
    <select class="form-control">
      <option  id="sendToAll" value="1">
       <label for="sendToAll">Send To All Patients</label>          </option>
      <option  id="sendToAllLeads" value="2">↩
        <label for="sendToAllProspect">Send To All Prospects</label>
                             </option>

       <option  id="sendToAllLeads2" value="3">
        <label for="sendToAllLeads">Send To All Leads</label>
       </option>

     </select>
   </div>
   <span id="or">OR</span>
</div>

The origin of this error and how can I solve it?

Thank you in advance!

You can't have labels inside an <option> tag. Place the <label> tag outside :

<label for="sendTo">Targeted Lists</label>
<div class="select-style" id="targeted-list">
    <select class="form-control" id="sendTo">
        <option  id="sendToAll" value="1">Send To All Patients</option>
        <option  id="sendToAllLeads" value="2">Send To All Prospects</option>
        <option  id="sendToAllLeads2" value="3">Send To All Leads</option>
    </select>
</div>

If you want to customise the look of your label, use a class on the option, that's all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM