how to add class to element with local storage with javascript

i have something error with local storage. i want to add class when i click button function collapseSidebar. but What I click (addClass) fixed
i’m sorry my english is bad.

this my javascript :

 collapseSidebar = function() {

this my html :

<body class="page-header-fixed">
  <input type="button" name="button" onclick="collapseSidebar();">