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:
- Concatenation a first table id's = "a_{num}", second table id's = "b_{num}" and that's on...
- 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..)
精彩评论