-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hx-vals="js: { a: event.target.value }"
errs
#1103
Comments
event.target
hx-vals="js: { a: event.target.value }" errs with
TypeError: Cannot read properties of undefined (reading 'target')`
hx-vals="js: { a: event.target.value }" errs with
TypeError: Cannot read properties of undefined (reading 'target')`hx-vals="js: { a: event.target.value }"
errs with TypeError: Cannot read properties of undefined (reading 'target')
hx-vals="js: { a: event.target.value }"
errs with TypeError: Cannot read properties of undefined (reading 'target')
hx-vals="js: { a: event.target.value }"
errs
I'm having a similar issue, except in my case |
the delay causing the event to be undefined definitely caught me off-guard and had to spend some time debugging @reedspool did u manage to work around it? |
I am currently having this issue myself, although I'm more interested in accessing the element This could probably be done with a simple Line 3840 in d890547
I will add a PR if a maintainer thinks this is a good idea! |
Sounds good to me @maekoos, feel free to dive into this and open a PR! |
Here's an example of the issue https://codepen.io/reedspool-gh/pen/XWYbRXo
For some reason, if clicking multiple times quickly,
hx-vals="js:{ test: event.target.value }">
causes an error,TypeError: Cannot read properties of undefined (reading 'target')
athtmx.org:1:29917
. I narrowed this down to the execution ofFunction(...)()
ingetValuesForElement
.If you click the button slowly, the count will appear and then increase. But if you click it twice quickly, an error appears and the HTMX no longer triggers upon clicking this button ever again.
I think this is two problems:
I narrowed the bug down to the second click having an
event
value ofundefined
instead of an actual event as expected.The text was updated successfully, but these errors were encountered: