[Solved] How can I convert this from jQuery to standard javascript?


You can use Element.classList the live demo

function addfunction(){
    link.forEach( function(e){
        e.classList.remove('selected');
    });

    this.classList.add('selected');
}

var link = [].slice.call(document.querySelectorAll("form img"));

link.forEach(function(e){
    e.addEventListener("click",addfunction,false);
});

6

solved How can I convert this from jQuery to standard javascript?