Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
958 views
in Technique[技术] by (71.8m points)

html - <div> and <select> tags

Can I have a <DIV> within an HTML <SELECT> tag?

e.g.:

<select tabindex="2" name="agegrp" id="agegrp" >
    <div> 
        <option value="-1">No preference</option>
    </div>
</select>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the specification:

<!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector -->

i.e. There is an element called "SELECT", the start tag is required, the end tag is required. It's children can be OPTGROUP elements and/or OPTION elements and there must be at least one of them.

Since a DIV is not an OPTGROUP or an OPTION, the answer is no.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...