5 ms·
Nah, 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
by geuis 18y ago
Nah, 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.