Home > Net >  CSS Selectors - how to grab all elements
CSS Selectors - how to grab all elements

Time:10-08

Could someone help how to grab all three elements from the DOM (marked it red) with CSS selector ?

With XPath Im already did it, but with CSS unfortunately I have problem. Thanks in advance

DOM

CodePudding user response:

The following will select your buttons, but could possibly select more if you have multiple forms on the page:

input[type="submit"] { ... }

/* Or more specifically */
input[type="submit"][class*="b-compose__"] { ... }

In your comment, you say:

With the use of button[name='nosend'] at the beginning of selector

There are two problems with this request.

  1. You are not using buttons, you are using <input type="submit" ...>, which get rendered as buttons by the browser.

  2. The [name='nosend'] part would only select the middle button. Each button has a different name. You could select all three by doing this:

input[name='doit'], 
input[name='nosend'], 
input[name='cancel'] { ... }
  • Related