title: set default class Javascript
body: <p>I am very much new to Javascript and I could need a little help with the following problem:</p>
  
  <p>I want to use the following function to make a header that closes and opens upon clicking it and I stumbled upon this function, in which I added the 'closed' class, which I would like to set as a default when the page is loaded initially. Does somebody have an idea for me, I would be very much grateful!</p>
  
  <pre><code>$(function() {
    var b = $("#contact");
    var w = $("#button");
    var l = $("#list");
  
    w.height(l.outerHeight(true));
  
    b.click(function() {
  
    if(w.hasClass('closed')) {
    w.removeClass('closed');
    w.addClass('open');
    w.height(l.outerHeight(true));
  } else {
    w.addClass('closed');
    w.height(0);
  }
  
    });
  });
  </code></pre>