Temporarily changes an element's attributes.
The element's original attributes will be restored when the preview ends.
This preview sets a temporary [app-loading=true] attribute on the targeted fragment:
up.preview('loading-attr', function(preview) {
preview.setAttrs({ 'app-loading': true })
})
The element or selector to change.
If omitted, the targeted fragment will be changed.
An object of attribute names and values to set.
To set an empty attribute, pass an empty string value.
To remove an attribute, use a value of null or undefined.
Tip Your coding agent can search these docs locally with the Unpoly agent skill