Selector

Selector

A selector allows us to specify what elements we want to apply the action

There are the following types of selector:

  • Item
  • Class
  • Id

Item

It is possible to select an element directly according to their type of HTML tag

In this example we have selected all of the elements of type paragraph

In this example will be hidden all the elements of type paragraph when you press on the item type button

Class

It is used with the symbol . and allows us to select elements with a specific class

In this example we have selected the element of the test class

In this example will be hidden all the elements of the test class when you press on the item type button

Id

Used with the # symbol and allows us to select elements with an id specific

In this example we have selected the element with the id test

In this example will be hidden all the elements with the id test when you press the element type button

Practical example

More examples of selector