开发者

Is there any way to have multiple ID:s with same name in one HTML document?

I have a form which has several tags.

is this possible:

   <sele开发者_如何学JAVAct name="select1" id="select1">
       <option id="1990" value="1990">1990</option>
       <option id="1991" value="1991">1991</option>
   </select>

   <select name="select2" id="select2">
       <option id="1990" value="1990">1990</option>
       <option id="1991" value="1991">1991</option>
   </select>

The ID are the same...

Thanks


No id can be assigned only once since it is an identity for just a single element. You need to use class instead but i wonder why you need to assign same ids? If you assign same ids to more than one element, and use javascript, etc to manipulate it, then only last element with same id will be taken care of ignoring all previous elements....

For more information, please see:

ID vs CLASS

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜