powerful-helmet-42757
06/27/2022, 1:30 AMancient-father-3063
06/27/2022, 5:33 AMdelightful-apartment-54642
06/27/2022, 5:37 AMaloof-football-7378
06/27/2022, 7:29 AMaloof-football-7378
06/27/2022, 7:30 AMcuddly-raincoat-38596
06/27/2022, 9:21 AM<input type="text"
hx-post="{% url 'qdbsuche' %}"
hx-target='#results'
hx-trigger="keyup changed delay:500ms"
name="search_term"
class="form-control-sm mr-2"
placeholder="Suchbegriff" />
i am trying to make a db-query and it is working fine.
i would really like to implement a "minimum" search value.
so the trigger fires after lets say the length of the input exceeds 3 letters.
Otherwise it will needlessly search the entire database for an empty string etc, which i do not want.
if my understanding is correct it currently waits for a change in the input field and then fires after 500ms. that is fine. But i really need to add this extra filtercuddly-raincoat-38596
06/27/2022, 9:22 AMcuddly-raincoat-38596
06/27/2022, 9:25 AMtarget.length > 2
but i am not sure if that is the correct syntax. from my understanding it is coma seperated. but if i add this, it seems to ignore my codecuddly-raincoat-38596
06/27/2022, 9:28 AMcuddly-raincoat-38596
06/27/2022, 9:36 AMcuddly-raincoat-38596
06/27/2022, 9:36 AMstocky-dentist-80693
06/27/2022, 11:20 AMkeyup[event.target.value.length>2] changed delay:500mscuddly-raincoat-38596
06/27/2022, 11:20 AMcuddly-raincoat-38596
06/27/2022, 11:31 AMlate-king-98305
06/27/2022, 11:56 AMhx attributes to your image, to make it defer loading, cause a GET or POST, etc. As far as the src attribute, though, you'll likely either write the same way you write your HTML. To change its value after the HTML has been delivered to the browser, as @powerful-helmet-42757 mentioned, you can use a plain JavaScript event or a lightweight library.
The "binding" story for htmx is that, for the most part, you don't need to. It's a mindset shift, especially for developers who may have learned the Angular / React / Vue styles first; if you stick with it, though, I think you'll find that it eliminates entire classes of complexity. And, as you mentioned, the community can't be beat - it's one of the best communities I've seen in my decades on the Internet. I'm about to have a question for that community myself. 🙂mysterious-toddler-20573
06/27/2022, 12:48 PMmysterious-toddler-20573
06/27/2022, 12:49 PMcuddly-raincoat-38596
06/27/2022, 1:05 PMcuddly-raincoat-38596
06/27/2022, 1:09 PMcuddly-raincoat-38596
06/27/2022, 1:16 PMcuddly-raincoat-38596
06/27/2022, 1:23 PMcuddly-raincoat-38596
06/27/2022, 1:24 PMancient-father-3063
06/27/2022, 1:48 PMancient-father-3063
06/27/2022, 1:48 PMancient-father-3063
06/27/2022, 1:48 PMancient-father-3063
06/27/2022, 1:48 PMancient-father-3063
06/27/2022, 1:52 PMcuddly-raincoat-38596
06/27/2022, 2:04 PMancient-father-3063
06/27/2022, 2:30 PMred-farmer-97020
06/27/2022, 3:17 PM