function Htmx::select

Creates a `data-hx-select` attribute.

This attribute instructs HTMX which content to swap in from a response. HTMX uses the given selector to select elements from the response. For example, passing 'data-drupal-selector="edit-theme-settings"' will instruct HTMX to select the element with this data attribute and value.

Parameters

string $selector: A CSS selector string.

Return value

static Returns this object to allow chaining methods.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

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

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