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 759
甜味超标
甜味超标 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:46

    At a minimum, Javascript code which uses getElementById() will return only one of the matching elements - which one will be undefined, and hence subject to cross-browser differences.

提交回复
热议问题