126 days ago · 5 min read1014 words · Tech · hide · Fediverse post

Earlier today and in a non web-related conversation, I saw someone talk about copying tabular data into different formats, like plain text and CSV. It got me thinking - this could be a useful feature for web sites and surely something pretty trivial to do in JavaScript. So I whipped up a quick demo. First, I added a table of course: <table id="table1"> <thead> <tr> <th>Name</th> <th>DOB</th> <th>Gender</th> <th>Breed</th> </tr> </thead> <tbody> <tr><td>Whiskers</td><td>2019-03-14</td><td>Male</td><td>Maine Coon</td></tr> <tr><td>Luna</td><td>2020-07-22</td><td>Female</td><td>Siamese</td></tr> <!-- bunch more rows --> <tr><td>Nala</td><td>2022-04-18</td><td>Female</td><td>Persian</td></tr> <tr><td>Molly</td><td>2022-01-11</td><td>Female</td><td>LaPerm</td></tr> </tbody> </table> Alright, so to enable this feature, I thought data attributes might be nice. This would let you use it on anything, a button, a link, image, etc. The data attribute would be responsible for pointing to the…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town