<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l" -->

---
title: htmx trigger request via JS event | daily.dev
description: Learn how to trigger a network request via a JS event in htmx by listening to the change event on a select HTML element and dispatching a create-new-team event...
canonical: https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: htmx trigger request via JS event | daily.dev
og:description: Learn how to trigger a network request via a JS event in htmx by listening to the change event on a select HTML element and dispatching a create-new-team event...
og:url: https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l
og:image: https://api.daily.dev/og/posts/GxqH5sV7l.png
og:image:alt: htmx trigger request via JS event
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# htmx trigger request via JS event

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 2 min read · 1 upvotes · 0 comments

## Summary

Learn how to trigger a network request via a JS event in htmx by listening to the change event on a select HTML element and dispatching a create-new-team event on the body.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/htmx-trigger-request-via-js-event>

---

Tags: [#alpinejs](https://daily.dev/tags/alpinejs), [#htmx](https://daily.dev/tags/htmx), [#javascript](https://daily.dev/tags/javascript), [#webdev](https://daily.dev/tags/webdev)

[View this post on daily.dev](https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"htmx trigger request via JS event","url":"https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l"},"datePublished":"2023-12-28T18:55:34.410Z","dateModified":"2024-01-19T02:12:21.750Z","description":"Learn how to trigger a network request via a JS event in htmx by listening to the change event on a select HTML element and dispatching a create-new-team event...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7c87a122721eba666b7933247636e7c7?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7c87a122721eba666b7933247636e7c7?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/htmx-trigger-request-via-js-event-gxqh5sv7l","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"alpinejs,htmx,javascript,webdev","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"htmx trigger request via JS event"}]}
```

