Skip to content

v4: Multi-Target not working with hx-target #3857

Description

@rollinger

Multi-Target not working with hx-target as suggested by the docs:
Contradicts https://four.htmx.org/docs#multiple-targets

Being aware of hx-partials and hx-swap-oob, aka the correct way - still the docs suggests I can swap a response to multiple targets, like below. I get no errors for the button clicks.

this.version = '4.0.0-beta4'

<!-- This Button swaps #r1 but not r2 -->
<button hx-get="/simple-response" hx-target="#r1, #r2">
    Get Response
</button>
<!-- This Button also swaps #r1 but not r2, even though r2 is defined first -->
<button hx-get="/simple-response" hx-target="#r2, #r1">
    Get Response
</button>
<!-- This Button also swaps #r1 and ignores r2, selected by class -->
<button hx-get="/simple-response" hx-target=".response-class">
    Get Response
</button>

<div id="r1" class="response-class">Request!</div>
<div id="r2" class="response-class">Request!</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions