From 65bd1e15b27083b6298c9f076433052f05226155 Mon Sep 17 00:00:00 2001 From: Elnu Date: Tue, 18 Jul 2023 15:41:52 -0700 Subject: [PATCH] Fix hx-on:* examples to use kebab-case event names, add clarification (#1611) --- www/content/attributes/hx-on.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/content/attributes/hx-on.md b/www/content/attributes/hx-on.md index f6e642e4..af8ffc05 100644 --- a/www/content/attributes/hx-on.md +++ b/www/content/attributes/hx-on.md @@ -19,7 +19,8 @@ The event name follows a colon `:` in the attribute, and the attribute value is ``` All htmx events can be captured, too! Make sure to use the [kebab-case event name](@/docs.md#events), -because DOM attributes do not preserve casing. +because DOM attributes do not preserve casing. For instance, `hx-on::beforeRequest` **will not work:** +use `hx-on::before-request` instead. To make writing these a little easier, you can use the shorthand double-colon `hx-on::` for htmx events, and omit the "htmx" part: @@ -39,8 +40,8 @@ events, and omit the "htmx" part: Adding multiple handlers is easy, you just specify additional attributes: ```html ```