function Htmx::target

Creates a `data-hx-target` attribute.

This attribute allows you to target a different element for swapping than the one issuing the AJAX request. There are a variety of target string syntaxes. See the URL below for details.

Parameters

string $target: The target descriptor.

Return value

static Returns this object to allow chaining methods.

See also

https://htmx.org/attributes/hx-target/

File

core/lib/Drupal/Core/Htmx/Htmx.php, line 788

Class

Htmx
Presents the HTMX controls for developers to use with render arrays.

Namespace

Drupal\Core\Htmx

Code

public function target(string $target) : static {
  $this->createStringAttribute('hx-target', $target);
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.