I made an account here just to comment on your post.
Thank you for the clarification. I am pretty new to javascript, so I fell in the trap of reading with .data() and setting with .attr(). I lost an hour on this, found the solution, but found it extremely confusing, annoying and frustrating.
I have little experience so I don't know why you cannot compare them (as the other users are saying), but when i looked up how to set my custom data atribute, the answers were pointing to .attr(), so I think the subject is not that clear to everyone and your article is really useful.
So thanks.
I made an account here just to comment on your post.
Thank you for the clarification. I am pretty new to javascript, so I fell in the trap of reading with .data() and setting with .attr(). I lost an hour on this, found the solution, but found it extremely confusing, annoying and frustrating.
I have little experience so I don't know why you cannot compare them (as the other users are saying), but when i looked up how to set my custom data atribute, the answers were pointing to .attr(), so I think the subject is not that clear to everyone and your article is really useful.
So thanks.