In the above example, we have rendered a div, paragraph and an anchor element. We have set href attribute of anchor tag. On click on Click Me button we are selecting all the elements having href attribute and changing its CSS. In above example, anchor tag is only element with href attribute. So the anchor tag is selected and CSS is applied to it.