Vanilla JavaScript - Wildcard (*) Selector

Raymond Raymond event 2022-08-15 visibility 4,577
more_vert

Code description

In vanilla JavaScript, we can use wildcard (*) to match multiple elements (nodes) in the HTML DOM object. We can also match elements with attribute starting with, ending with or contains certain values.

For example, the following selectors will 

  • [name^="password"] will match all elements with name starting with password.
  • [name$="password"] will match all elements with name ending with password.
  • [name*="password"] will match all elements with name containing password.

Code snippet

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts