Class name of new element copied from old element? #2125
SebastianStehle
started this conversation in
General
Replies: 1 comment
-
I found the reason. If an element has the same ID it copies the attributes from an existing element with the same ID. So I simplified my result a little bit
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am learning htmx at the moment and just playing around. I am using bootstrap and normal html validation for my form.
The error message is only shown when the form was submitted once. I am using a simple htmx extension that adds this class:
![image](https://private-user-images.githubusercontent.com/1236435/292579729-4402262e-c91b-4713-96df-15ce0b373486.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MjAxMjYsIm5iZiI6MTcyMTUxOTgyNiwicGF0aCI6Ii8xMjM2NDM1LzI5MjU3OTcyOS00NDAyMjYyZS1jOTFiLTQ3MTMtOTZkZi0xNWNlMGIzNzM0ODYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjBUMjM1NzA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGMzNWI5OWZkODFkYWY5ODk5ODIzMzYwNDAxMDdiNmY2YzQ0M2Y0NzgzOTRkNmY5ZjJhZWQ3OGZmYWRiNGZjNiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.53Gfauyfqaq86vbXzEkabJJtfJgxupdxUANYhTtFdSQ)
In my backend endpoint I am returning a few HTML artefacts, the actual form, the todo item and an alert:
As you can see the returning html form does not contain the
was-validated
class. But when the html is returned, I see the error message for a fraction of a second:This could only happen when the form is not replaced in one frame, so that only the inner html is replaced (where the input is empty) and then outer element which then replaces the class name.
I am trying to debug it, but I have not found any reason yet.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions