jQuery [Attribut~=Wert] Selektor

❮ jQuery-Selektoren

Beispiel

Wählen Sie alle <input>-Elemente mit einem name-Attribut aus, das das spezifische Wort „nation“ enthält:

$("input[name~='nation']")

Definition und Verwendung

Der Selektor [attribute~=value] wählt jedes Element mit einem bestimmten Attribut aus, dessen Wert eine bestimmte Zeichenfolge enthält.

Tipp: Der String kann Leerzeichen enthalten.


Syntax

$("[attribute~='value']")

Parameter Description
attribute Required. Specifies the attribute to find
value Required. Specifies the string value

❮ jQuery-Selektoren