Opinion: in HTML, Possible Duplicate IDs or Non-Standard Attributes?

后端 未结 10 2008
说谎
说谎 2020-12-17 22:49

It seems pretty common to want to let your javascript know a particular dom node corresponds to a record in the database. So, how do you do it?

One way I\'ve seen t

10条回答
  •  难免孤独
    2020-12-17 23:21

    If you set non-standard properties, be sure to either set them programmatically (as everything will be legal that way) or go through the trouble of revising the dtd !-)

    But I would use an ID with a meaningful word prepending the DB-id and then use .getElementById, as every necessary informtion is at hand ...

提交回复
热议问题