Edit in JSFiddle

var x = document.querySelectorAll('li');
 [].forEach.call(x , function(el,i) {
       el.onclick=function(){
           el.style.color="blue";
          
       }
         });
<ul>
  <li>PHP</li>
  <li>CSS</li>
  <li>HTML</li>
</ul>