# TagAction > A tiny script that makes plain, semantic HTML behave the way people expect: sortable tables, copy buttons on code, show/hide on password fields, dialogs that open from a button, dropdown menus, live totals. No classes, no build step, no page script, no new syntax. Write standard HTML elements and attributes; TagAction finds them. Every page still works with JavaScript off. Add this to `` (with or without TagBrush.css, which it is designed to sit beside): ```html ``` ## Rules for writing pages - Write the HTML you would write anyway. TagAction adds behavior to native elements and ARIA attributes; there is nothing to call and no classes to add. - Do not write JavaScript for the behaviors below. Do not add `onclick` handlers, IDs for scripts, or framework attributes for them. - Keep pages usable without JavaScript. A control that only works with TagAction (a filter box with no form, an "Add row" button) may carry `hidden`; TagAction shows it. - Turn TagAction off for an element and everything inside it with `data-tagaction="off"`. - Content added later (htmx swaps, page scripts) is enhanced automatically. To enhance content yourself, call `TagAction.init(element)`. ## Automatic behaviors (no attributes needed) - Dialogs: a modal `` closes when you click its backdrop. Add `closedby="closerequest"` to keep it open. Open one from a button with the browser's own attributes: `

Delete this file?

`. Close from inside with `command="close"`. - Tables: every `` with a `` and two or more body rows sorts when you click a column header, and sets `aria-sort`. Numbers sort as numbers. Put the sort value in `$1.2k` or `
` keeps that column unsortable. - Forms: validation messages (from `required`, `type="email"`, `pattern`, `minlength`, …) appear as text under the field instead of a bubble, and `aria-invalid` is set. A `` right after the field is used for the message, and its help text comes back once the field is fixed. The submit button is disabled with `aria-busy="true"` while the form is sent. A `method="post"` form with unsent changes warns before you leave the page. - ``. - `` lists the chosen file names. Files can be dropped onto any file input or its `