I want to assign a custom value to an element. It seems that .attr(customName, value) will work fine for this. If the attribute doesn't exist (it won't) jQuery creates it and lays in the value I provide. Later I'm able to read the value with .attr(customName), as if it were a normal HTML-known attribute. I know there's an HTML5 .data() method for this kind of thing but it's not persistent. If I move the html off to a disk and then retrieve it, anything set with data() will be gone, while .attr() goes right into the HTML.
I don't see in the .attr() documentation where it's guaranteed to create a new attr name if it doesn't recognize what you give it, so I'm a bit nervous. Is it safe to use .attr() this way? Thanks.