开发者

id or class? dilemma

There are several tables, where row id - is the number of records in the database, there is a problem. If there are few tables on the page, the id will be repeated. And it's not good, because jQuery does not work correctly because of dublicate 开发者_如何转开发id's. I only have 2 outputs:

  1. Concatenation a first table id's = "a_{num}", second table id's = "b_{num}" and that's on...
  2. Replace the id to class

But I don't like both of them. Maybe there is a normal solution to this problem?


Option 3. Use HTML5 data- attributes to store meta data.

Then just set it on the table

$("table#someId").data("database-records", number)


Maybe you need none of them?

Use a selector for all tables, then filter for the number of rows (or whatever you use for displaying the rows..)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜