Code javascript

Vanilla JavaScript - Wildcard (*) Selector

Raymond Raymond visibility 3,637 comment 0 access_time 2 years ago language English

descriptionCode 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.
fork_rightFork
more_vert
copyright This page is subject to Site terms.
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts