[javascript] setAttribute('display','none') not working

function classInfo(e){
    document.getElementById('classRight').setAttribute('display','none');
    alert(e);   
}

I think this code is very straightforward bit it's not working, and is not hiding the element in question. I am getting my alert, which makes me think there is no issue.

Any help would be appreciated.

This question is related to javascript dom

The answer is


Try this:

setAttribute("hidden", true);

It works for me

setAttribute('style', 'display:none');