2 ms·
I am generally against lists on HN but this was really good. My one thought: does #5 contradict #1?
by JoelSutherland 18y ago
I am generally against lists on HN but this was really good.
My one thought: does #5 contradict #1?
- geuis 18y agoNah, the intent is for 2 different things. You can add/remove a class on demand for display, not data, purposes. If I was editing text in an input or text area and wanted to change its background color for example. the .data() method would be if I wanted to store content for the element I was editing. Say if you store its current data using .data() and then blank the input, and if the user blurs out from the field without entering new data, you can replace it with the original.