Skip to content
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

[Doc improvment] Add a example for set value for a input element. #538

Open
zw963 opened this issue May 17, 2024 · 1 comment
Open

[Doc improvment] Add a example for set value for a input element. #538

zw963 opened this issue May 17, 2024 · 1 comment

Comments

@zw963
Copy link

zw963 commented May 17, 2024

Consider we are use so many input element together with hx-include when use htmx, there is no a example for this is strange.

I spend some times to figure this out, following is a example: (use

<input type="hidden" name="value1" value="">
<span></span>
<tc-range-slider 
min="0"
max="100"
value1="10"
value2="90"
round="0"
script="on change put my.value1 into the previous <span/>
then put my.value2 into the next <span/>
then set (previous <input/>).value to my.value1
then set (next <input/>).value to my.value2
"
<input type="hidden" name="value2" value="">
<span></span>
>

The usage of set (previus <input/>).value is missing in the document.

Do you consider add a example like that?


One more question here, can we simplify above script a bit?

because we set same my.value1 to both input tag and span tag, so i am wonder if we can use like this:

on change set (previous <input/>).value and (previous <span/>).innerHTML to my.value1

But it not work, because and keyword used in the if expression, it not work here, any alternative?

Thanks

@zw963
Copy link
Author

zw963 commented May 22, 2024

Does anyone still maintain this project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant