I have a question about hyperscript and htmx


It seems like you could write some (all?) htmx features as hyperscript. Is there a lot of overlap between the two? I haven’t used either yet, so I am in the “get my head wrapped around what they’re trying to do” phase of this.


htmx is the primary technology I would recommend for most web applications: you drive server interactions using HTML-based attributes, and stay within the HTML model. Very simple and you can accomplish a lot (see )

hyperscript is a more speculative project for doing pure front end scripting. it is event-oriented and thus plays very well with htmx (which has an extensive event model: ) I reach for it when I want to do something purely client side. You can consider it a modern alternative to jQuery if you like.

I would not build an entire app in hyperscript, but rather would use it to embellish an existing app with light front end code.

htmx and alpinejs


thanks. i saw another today. . i’ve only toyed with htmx so far and wondered. do you have to go balls deep with it or can you just use it sparingly to begin with and still do ur own thing like.


htmx is incremental and can be used for as much or as little of your site as you want.

For example, if you have a slow chunk of your site that you want to lazy load, it’s two attributes:

Alpine is a front-end oriented library that pairs well with htmx . A lot of people use the two together: htmx for server interaction, alpine for pure front end work .

There is also hyperscript , a sibling project of htmx , that we are working on and that addresses use cases similar to alpine, but from a different direction:


What are the core philosophical differences between @htmx_org and @unpolyjs ?

Question Both are trying to bring the joy of web development back and it’s cool, but which one should I chose and why ?

Response htmx is a relatively low level extension of HTML

unpoly has more structure (e.g. layers, animations) and gives you more ootb hotwire is even more structured and “top down”/batteries included each has pros & cons, all are great options

(hope that’s a fair comparison @unpolyjs)

Does someone have an example of using Django forms and htmx ?

Does htmx support JSON POST/PUT commands ?


charris — 2021-10-15 à 22:26 I heard this from someone with a lot more dev-fu than me and this is his only real complaint at this point about htmx: if you want to do “real” API-style work, with JSON bodies, you have to write script; HTMX doesn’t support JSON POST/PUT. For my posts and puts I had to back off and use fetch.

Response 1cg — 2021-10-15 à 22:37 We use “normal” form encoding in the requests we submit. We do have a cutpoint for extensions do to their own encoding however:

function encodeParamsForBody(xhr, elt, filteredParameters) {
    var encodedParameters = null;
    withExtensions(elt, function (extension) {
        if (encodedParameters == null) {
            encodedParameters = extension.encodeParameters(xhr, filteredParameters, elt);
    if (encodedParameters != null) {
        return encodedParameters;
    } else {
        if (getClosestAttributeValue(elt, "hx-encoding") === "multipart/form-data" ||
            (matches(elt, "form") && getRawAttribute(elt, 'enctype') === "multipart/form-data")) {
            return makeFormData(filteredParameters);
        } else {
            return urlEncode(filteredParameters);

so if you wanted to submit JSON you could

When using htmx-boost is there a way to designate elements that should be ignored ?


mauricioarango — Aujourd’hui à 03:40 Little question: when using htmx-boost is there a way to designate elements that should be ignored ? I placed the htmx attributes on the document’s body. And it almost works perfect for my needs, but there are a couple of forms, that have their own logic and validations, and , ideally, should be ignored by htmx-boost. Thanks so much for your feedback.

Response 1cg — 2021-10-16 à 03:45

put hx-boost=’false’ on those elements