Edit this page

up.fragment :maybe
HTML selector

Marks a target selector as optional.

If a :maybe selector is not found in the current page or the server response, Unpoly will skip rendering the fragment instead of throwing an error.

When updating multiple fragments you may combine required and optional selectors in a single target string.

An optional selector will be omitted from an X-Up-Target header unless it matches in the current page.

Example

This link will update the fragments .content (required) and .details (optional):

<a href="/card/5" up-target=".content, .details:maybe">...</a>

Only the fragment .content is required to match. If .details is missing in the current page or the server response, Unpoly will only update .content without an error.