Question: Let's say I want that every time the user click any link an alert pops up that says "hohoho". 
Do I need to add `onclick="alert('hohoho')"` to every link or can I set this with CSS so that it works with every link?

Answer: 
Many 3rd party JavaScript libraries allow you to select all elements that have a CSS class of a particular name applied to them. Then you can iterate those elements and dynamically attach the handler.

There is no CSS-specific manner to do this.

In [JQuery](http://jquery.com/), you can do:

```
$(".myCssClass").click(function() { alert("hohoho"); });

```
Asking about "a class" in the question title, the answer is `getElementsByClassName`:

```
  var hrefs = document.getElementsByClassName("YOUR-CLASS-NAME-HERE");
  for (var i = 0; i < hrefs.length; i++) {
   hrefs.item(i).addEventListener('click', function(e){
    e.preventDefault(); /*use if you want to prevent the original link following action*/
    alert('hohoho');
   });
  }

```