What practical problem will i face if i use same #id more than one time on a page , other than validation error “ID is already defined”?

前端 未结 7 754
甜味超标
甜味超标 2021-01-13 15:09

First of all I alwyas use one #ID. just asking this question to know deep reason behind it.

Is it only a matter of W3C validation? or more than that

7条回答
  •  失恋的感觉
    2021-01-13 15:59

    This post is just to add some more points to this interesting discussion ..

    Its true that .. Id must have been unique and usage of 'duplicate IDs' must have been depreciated by browsers itself ..
    But may be because these browsers want to make it more coder-friendly, don't seriously consider the "id" matter ..
    So apart from javascript this mistake doesn't matter much to us too ...
    (Depends on the version of the different browsers) Even CSS has no problem with it .. (apart from validation errors) check this out ..

    
    
    
    
    

    But I assure that in-case of javascript usage it is prone to hell of bugs .. Once I had faced this problem .. where I had used same name for ID as well as NAME .. !

    :-)

提交回复
热议问题