https://htmx.org logo
Hi all, I've come across an issue where `"quoted"`...
# htmx-general
b
Hi all, I've come across an issue where
"quoted"
values within
hx-vals
cause a SyntaxError (
htmx.min.js:1 SyntaxError: Expected ',' or '}' after property value in JSON at position 126
). e.g.
hx-vals='{"key": ""val""}'
where
"val"
is user input. Using Django's
|escapejs
filter will escape the quotes appropriately:
hx-vals='{"key": "\u0022val\u0022"}'
. This causes the request to work as expected. My question is: Is escaping the characters like this the correct approach, or am I missing something?