DOM attributes and data
This demo covers Tripous helpers for normal HTML attributes and data-* attributes.
These helpers are small wrappers around browser DOM APIs, but they accept either an element or a
selector and keep the Tripous code style consistent.
Target element
All buttons operate on this element. Inspect it in DevTools after each action to see the actual attributes.
data-* tests.
Normal attributes
tp.SetAttributes() assigns multiple attributes. tp.Attribute()
gets or sets one attribute. tp.HasAttribute() and
tp.RemoveAttribute() inspect and remove attributes.
data-* attributes
tp.Data() gets or sets data-* attributes. It accepts a
single name/value pair or an object with multiple data values.
Clear output
The clear button only clears the log. Attributes remain on the target so they can still be inspected in DevTools.