+ 5

[data-*] css / js

I append to a table some <tr> with for each data-tr="tr-*", where * is the number of the index of the tr in the table. so there is tr-1, tr-2, tr-3 etc... how in css could I take this : [data-tr=tr-*] { opacity: 0; } I don't want to use [data-tr] { opacity: 0; }

17th Apr 2018, 9:07 AM
NoxFly
NoxFly - avatar
6 Answers
+ 2
NoxFly ドăƒȘケン I found something about the data attributes in classes. Look here: https://css-tricks.com/almanac/selectors/a/attribute/
17th Apr 2018, 9:21 AM
đŸ€– Basile Laderchi
+ 4
oh ok thanks !
17th Apr 2018, 9:38 AM
NoxFly
NoxFly - avatar
+ 4
lol 😁 you're welcome too :p
17th Apr 2018, 9:47 AM
NoxFly
NoxFly - avatar
+ 3
oh, if you want to use classes it's same. I want say all classes tr-* (a number) have opacity 0. and I want to select just one of them to opacity 1. not to select all
17th Apr 2018, 9:16 AM
NoxFly
NoxFly - avatar
+ 2
NoxFly ドăƒȘケン you're welcome BTW I didn't know you could do that, so I learnt something too
17th Apr 2018, 9:44 AM
đŸ€– Basile Laderchi
0
NoxFly ドăƒȘケン why instead of "data-tr" don't you use classes?
17th Apr 2018, 9:14 AM
đŸ€– Basile Laderchi